Advertisement
deadropz

triple jump

Mar 14th, 2017
1,436
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. -- Made by Masteralan --
  2. --[[
  3. This script allows the player to perform triple jumps
  4. by jumping consecutively, 3 times in a row. The player's
  5. jump height will increase by adding velocity, wich is easy
  6. to edit.
  7.  
  8. You can customize this script to have as many jumps as you
  9. want, but it will take a little work.
  10.  
  11. I might make animation compatibility later, but for now, enjoy!
  12. --]]
  13. local plr = game.Players.LocalPlayer --Finds player
  14. local char = game.Workspace:WaitForChild(plr.Name) --Waits for character to spawn in
  15. local hum = char:WaitForChild("Humanoid") --Waits for humanoid to load in
  16. local sound = Instance.new("Sound")
  17. sound.SoundId = 'http://www.roblox.com/asset/?id=158309736' --Waits for script to load "JumpSound"
  18.  
  19. stage = 0
  20. jumping = false
  21. falling = false
  22.  
  23.  
  24. -- Jumps --
  25. function onJump(val)
  26. jumping = val
  27. print(stage)
  28.  
  29. if jumping == true and stage > 1 and stage < 3 then
  30. --print("Triple jump!")
  31. stage = 3
  32. char.Torso.Velocity = char.Torso.Velocity + Vector3.new(0, 125, 0)
  33.  
  34. sound.Pitch = 1.5
  35. sound:Play()
  36. wait(1)
  37. stage = 0
  38. elseif jumping == true and stage > 0 and stage < 2 then
  39. --print("Double jump!")
  40. stage = 2
  41. char.Torso.Velocity = char.Torso.Velocity + Vector3.new(0, 85, 0)
  42.  
  43. sound.Pitch = 1.25
  44. sound:Play()
  45. elseif jumping == true and stage < 1 then
  46. --print("Normal jump!")
  47. stage = 1
  48.  
  49. sound.Pitch = 1
  50. sound:Play()
  51. end
  52. end
  53. hum.Jumping:connect(onJump)
  54.  
  55.  
  56. -- Jump Timeout --
  57. function onFall(val)
  58. falling = val
  59. if val == false then --When player lands...
  60. wait(0.25) --Next jump times out after .2 seconds.
  61. if stage > 0 and falling == false then
  62. stage = 0 --Resets jumps.
  63. end
  64. end
  65. end
  66. hum.FreeFalling:connect(onFall)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement