Advertisement
Drvays

Double Jump

Dec 19th, 2022
28,724
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. --[[ Made by coolcapidog
  2. Channel ->> https://www.youtube.com/c/coolcapidog
  3. You can change the settings but you shouldn't change anything except settings.
  4. ]]
  5.  
  6. ----------------------------------------- Settings
  7. local MaxJumps = 2
  8. local JumpCooldown = 0.2
  9. ----------------------------------------- Settings
  10.  
  11. local UIS = game:GetService("UserInputService")
  12. local Player = game.Players.LocalPlayer
  13. local Char = Player.Character or Player.CharacterAdded:Wait()
  14. local Humanoid = Char:WaitForChild("Humanoid")
  15. local NumJumps = 0
  16. local canjump = false
  17.  
  18. Humanoid.StateChanged:Connect(function(oldstate, newstate)
  19. if Enum.HumanoidStateType.Landed == newstate then
  20. NumJumps = 0
  21. canjump = false
  22. elseif Enum.HumanoidStateType.Freefall == newstate then
  23. wait(JumpCooldown)
  24. canjump = true
  25. elseif Enum.HumanoidStateType.Jumping == newstate then
  26. canjump = false
  27. NumJumps += 1
  28. end
  29. end)
  30.  
  31. UIS.JumpRequest:Connect(function()
  32. if canjump and NumJumps < MaxJumps then
  33. Humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
  34. end
  35. end)
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement