Advertisement
Yahoqlqlwsk

Double Jump Script

Oct 30th, 2024
415
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. ----------------------------------------- Settings
  2. local MaxJumps = 5
  3. local JumpCooldown = 0
  4. ----------------------------------------- Settings
  5.  
  6. local UIS = game:GetService("UserInputService")
  7. local Player = game.Players.LocalPlayer
  8. local Char = Player.Character or Player.CharacterAdded:Wait()
  9. local Humanoid = Char:WaitForChild("Humanoid")
  10. local NumJumps = 0
  11. local canjump = false
  12.  
  13. Humanoid.StateChanged:Connect(function(oldstate, newstate)
  14. if Enum.HumanoidStateType.Landed == newstate then
  15. NumJumps = 0
  16. canjump = false
  17. elseif Enum.HumanoidStateType.Freefall == newstate then
  18. wait(JumpCooldown)
  19. canjump = true
  20. elseif Enum.HumanoidStateType.Jumping == newstate then
  21. canjump = false
  22. NumJumps = NumJumps + 1
  23. end
  24. end)
  25.  
  26. UIS.JumpRequest:Connect(function()
  27. if canjump and NumJumps < MaxJumps then
  28. Humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
  29. end
  30. end)
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement