Advertisement
nofascistsaloudxD

Double Jump Progress

Feb 19th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.80 KB | None | 0 0
  1. local plr = game:GetService("Players").LocalPlayer
  2. local Char = script.Parent
  3. local FirstJump = false
  4. local SecondJump = false
  5. local JumpForce = Char.Humanoid.JumpPower
  6. local mouse = plr:GetMouse()
  7.  
  8. ---[[DISABLE_PLAYER_JUMP_ABILITY]]--- --This section simply disabled the player's ability to jump.
  9. function ResetEvent()
  10.     Event2 = Char.Humanoid.Changed:Connect(function(prop)
  11.         if prop == "Jump" then
  12.             Char.Humanoid.Jump = false
  13.             ResetEvent()
  14.             Event2:Disabled
  15.         end
  16.     end)
  17. end
  18. Event = Char.Humanoid.Changed:Connect(function(prop)
  19.     if prop == "Jump" then
  20.         Char.Humanoid.Jump = false
  21.         ResetEvent()
  22.         Event:Disabled
  23.     end
  24. end)
  25. ---[[END_DISABLE_PLAYER_JUMP_ABILITY_BLOCK]]---
  26.  
  27. plr:GetService("UseInputService").InputBegan:Connect(function(input)
  28.     if input = 32 then
  29.         if SecondJump == false then
  30.             if FirstJump == false then
  31.                 local CF = CFrame.new(Char.Torso.Position, mouse.hit.p)
  32.                 local LookVector = CF.lookVector
  33.                 Char.Torso.Velocity = LookVector * JumpForce
  34.                 FirstJump = true
  35.                 Event = Char["Right Leg"].Touched:Connect(function(part)
  36.                     if part ~= Char.Torso or part ~= Char["Left Leg"] or part ~= Char["Right Arm"] or part ~- Char["Left Arm"] then
  37.                         FirstJump = false
  38.                         SecondJump = false
  39.                         Event:Disconnect()
  40.                     end
  41.                 end)
  42.             elseif FirstJump == true and SecondJump == false then
  43.                 local CF = CFrame.new(Char.Torso.Position, mouse.hit.p)
  44.                 local LookVector = CF.lookVector
  45.                 Char.Torso.Velocity = LookVector * JumpForce
  46.                 SecondJump = true
  47.                 Event2 = Char["Right Leg"].Touched:Connect(function(part)
  48.                     if part ~= Char.Torso or part ~= Char["Left Leg"] or part ~= Char["Right Arm"] or part ~= Char["Left Arm"] then
  49.                         SecondJump = false
  50.                         FirstJump = false
  51.                         Event2:Disconnect()
  52.                     end
  53.                 end)
  54.             end
  55.         end
  56.     end
  57. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement