Advertisement
DrawingJhon

Multiple Jumps Script

Mar 20th, 2021 (edited)
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.74 KB | None | 0 0
  1. local UIS = game:GetService("UserInputService")
  2. local character = game:GetService("Players").LocalPlayer.Character
  3. local humanoid = character:findFirstChildOfClass("Humanoid")
  4.  
  5. local maxMultipleJumps = 1
  6. local numJumps = 0
  7. local lastJump = tick()
  8.  
  9. local function JumpRequest()
  10.     if tick() - lastJump >= .2 then
  11.         if humanoid:GetState() == Enum.HumanoidStateType.Freefall and numJumps < maxMultipleJumps then
  12.             numJumps = numJumps + 1
  13.             humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
  14.         end
  15.     end
  16. end
  17.  
  18. humanoid.StateChanged:Connect(function(old, new)
  19.     if new == Enum.HumanoidStateType.Landed then
  20.         numJumps = 0
  21.     end
  22.     if new == Enum.HumanoidStateType.Jumping then
  23.         lastJump = tick()
  24.     end
  25. end)
  26.  
  27. UIS.JumpRequest:Connect(JumpRequest)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement