Advertisement
koolusername

infjump

Feb 9th, 2020
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. local UIS = game:GetService("UserInputService")
  2. local player = game.Players.LocalPlayer
  3. local character
  4. local humanoid
  5.  
  6. local canDoubleJump = false
  7. local hasDoubleJumped = false
  8. local oldPower
  9. local time_delay = 0.2
  10. local jump_multiplier = 1
  11. function onJumpRequest()
  12. if not character or not humanoid or not character:IsDescendantOf(workspace) or humanoid:GetState() == Enum.HumanoidStateType.Dead then
  13. return
  14. end
  15.  
  16. if canDoubleJump and not hasDoubleJumped then
  17. hasDoubleJumped = false
  18. --humanoid.JumpPower = oldPower * jump_multiplier
  19. humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
  20. end
  21. end
  22.  
  23. local function characterAdded(new)
  24. character = new
  25. humanoid = new:WaitForChild("Humanoid")
  26. hasDoubleJumped = false
  27. canDoubleJump = false
  28. oldPower = humanoid.JumpPower
  29.  
  30. humanoid.StateChanged:connect(function(old, new)
  31. if new == Enum.HumanoidStateType.Landed then
  32. canDoubleJump = false
  33. hasDoubleJumped = false
  34. humanoid.JumpPower = oldPower
  35. elseif new == Enum.HumanoidStateType.Freefall then
  36. -- wait(time_delay)
  37. canDoubleJump = true
  38. end
  39. end)
  40. end
  41.  
  42. if player.Character then
  43. characterAdded(player.Character)
  44. end
  45.  
  46. player.CharacterAdded:connect(characterAdded)
  47. UIS.JumpRequest:connect(onJumpRequest)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement