Advertisement
KashTheKingYT

Double Jump | Infinite Jump

Aug 8th, 2022
4,195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.51 KB | None | 0 0
  1. local char = script.Parent
  2. local hum = char:WaitForChild("Humanoid")
  3.  
  4. local uis = game:GetService("UserInputService")
  5.  
  6. local jumps = 0
  7. local maxJumps = 2
  8.  
  9. local currentTick = tick()
  10.  
  11. hum.StateChanged:Connect(function(oldState, newState)
  12.     if newState == Enum.HumanoidStateType.Landed then
  13.         jumps = 0
  14.     end
  15. end)
  16.  
  17. uis.JumpRequest:Connect(function()
  18.     if jumps < maxJumps and tick() - currentTick > 0.2 then
  19.         jumps += 1
  20.         currentTick = tick()
  21.         hum:ChangeState(Enum.HumanoidStateType.Jumping)
  22.     end
  23. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement