Advertisement
13213

Doublejump

May 21st, 2022 (edited)
1,131
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local UIS = game:GetService("UserInputService")
  2. local Humanoid = script.Parent:WaitForChild("Humanoid")
  3.  
  4. local db = true
  5. local CanDoubleJump, DoubleJumped = false, false
  6.  
  7. local function JumpRequest()
  8.     if db then
  9.         db = false
  10.  
  11.         if CanDoubleJump and not DoubleJumped then
  12.             DoubleJumped = true
  13.             Humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
  14.         end
  15.  
  16.  
  17.         task.wait(.2)
  18.         db = true
  19.     end
  20. end
  21.  
  22. UIS.JumpRequest:Connect(JumpRequest)
  23.  
  24. local function StateChanged(_, new)
  25.     if new == Enum.HumanoidStateType.Landed then
  26.         CanDoubleJump = false
  27.         DoubleJumped = false
  28.     elseif new == Enum.HumanoidStateType.Freefall and not DoubleJumped then
  29.         CanDoubleJump = true
  30.         DoubleJumped = false
  31.     end
  32.  
  33. end
  34.  
  35. Humanoid.StateChanged:Connect(StateChanged)
  36.  
  37.  
  38.  
  39.  
  40. --usar em --local-- script ou ver o video
Advertisement
RAW Paste Data Copied
Advertisement