Advertisement
xmaanzach

DoubleJump Tutorial

Jan 7th, 2018
1,176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. local UserInputService = game:GetService("UserInputService")
  2. local lastjumptick = tick()
  3. local Jumped = 1
  4. local function onInputBegan(input,gameProcessed)
  5. if input.UserInputType == Enum.UserInputType.Keyboard then
  6. local keyPressed = input.KeyCode
  7. if keyPressed == Enum.KeyCode.Space then
  8. if Jumped == 1 then
  9. Jumped = 2
  10. else
  11. if Jumped == 2 and tick() - lastjumptick <= .5 then
  12. local JumpBrick = Instance.new("Part",workspace)
  13. JumpBrick.CFrame = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame * CFrame.new(0,-2,0)
  14. JumpBrick.Size = Vector3.new(2,.2,2)
  15. JumpBrick.Anchored = true
  16. JumpBrick.Transparency = 1
  17. game.Players.LocalPlayer.Character.Humanoid.JumpPower = 60
  18. game.Debris:AddItem(JumpBrick,.5)
  19. wait(.5)
  20. game.Players.LocalPlayer.Character.Humanoid.JumpPower = 50
  21. end
  22. Jumped = 1
  23. end
  24. lastjumptick = tick()
  25. end
  26. end
  27. end
  28.  
  29. UserInputService.InputBegan:connect(onInputBegan)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement