Advertisement
ToxinKindaScripts

Simple Infinite Jump

Aug 25th, 2021
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. --Script not made by me
  2.  
  3. --Credits: https://www.youtube.com/watch?v=8XBrl484_fs
  4.  
  5. local UIS = game:GetService("UserInputService")
  6. local player = game.Players.LocalPlayer
  7. local character
  8. local humanoid
  9.  
  10. local canDoubleJump = false
  11. local hasDoubleJumped = false
  12. local oldPower
  13. local time_delay = 0.2
  14. local jump_multiplier = 1 -- set to 1 for a normal double jump, increase for the second jump to be higher
  15.  
  16. function onJumpRequest()
  17. if not character or not humanoid or not character:IsDescendantOf(workspace) or humanoid:GetState() == Enum.HumanoidStateType.Dead then
  18. return
  19. end
  20.  
  21. if canDoubleJump and not hasDoubleJumped then
  22. hasDoubleJumped = false
  23. humanoid.JumpPower = oldPower * jump_multiplier
  24. humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
  25. end
  26. end
  27.  
  28. local function characterAdded(new)
  29. character = new
  30. humanoid = new:WaitForChild("Humanoid")
  31. hasDoubleJumped = false
  32. canDoubleJump = false
  33. oldPower = humanoid.JumpPower
  34.  
  35. humanoid.StateChanged:connect(function(old, new)
  36. if new == Enum.HumanoidStateType.Landed then
  37. canDoubleJump = false
  38. hasDoubleJumped = false
  39. humanoid.JumpPower = oldPower
  40. elseif new == Enum.HumanoidStateType.Freefall then
  41. wait(time_delay)
  42. canDoubleJump = true
  43. end
  44. end)
  45. end
  46.  
  47. if player.Character then
  48. characterAdded(player.Character)
  49. end
  50.  
  51. player.CharacterAdded:connect(characterAdded)
  52. UIS.JumpRequest:connect(onJumpRequest)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement