Advertisement
HenloMyDude

inf jump

Aug 19th, 2019
1,798
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. local UserInputService = game:GetService("UserInputService")
  2. script.Parent = owner.Character
  3. local character = script.Parent
  4.  
  5. local humanoid = character:WaitForChild("Humanoid")
  6.  
  7. local doubleJumpEnabled = true
  8.  
  9. humanoid.StateChanged:Connect(function(oldState, newState)
  10. if newState == Enum.HumanoidStateType.Jumping then
  11. if not doubleJumpEnabled then
  12. wait(.2)
  13. if humanoid:GetState() == Enum.HumanoidStateType.Freefall then
  14. doubleJumpEnabled = true
  15. end
  16. end
  17. elseif newState == Enum.HumanoidStateType.Landed then
  18. doubleJumpEnabled = true
  19. end
  20. end)
  21.  
  22. UserInputService.InputBegan:Connect(function(inputObject)
  23. if inputObject.KeyCode == Enum.KeyCode.Space then
  24. if doubleJumpEnabled then
  25. if humanoid:GetState() ~= Enum.HumanoidStateType.Jumping then
  26. humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
  27. spawn(function()
  28. doubleJumpEnabled = true
  29. end)
  30. end
  31. end
  32. end
  33. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement