Advertisement
Maybetruth

Script

Oct 25th, 2020
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. local passId = 4916610
  2. local MPS = game:GetService("MarketplaceService")
  3.  
  4. local function isAuthenticated(userId, gamePassId) -- define outside the PlayerAdded event
  5. return MPS:UserOwnsGamePassAsync(userId, gamePassId)
  6. end
  7.  
  8. game:GetService("Players").PlayerAdded:Connect(function(plr) -- :connect is deprecated, use :Connect
  9.  
  10. plr.CharacterAdded:Connect(function(char) -- wait for the character!
  11. if isAuthenticated(plr.UserId, passId) then
  12. local UIS = game:GetService("UserInputService")
  13. local player = game.Players.LocalPlayer
  14. local character
  15. local humanoid
  16.  
  17. local canDoubleJump = false
  18. local hasDoubleJumped = false
  19. local oldPower
  20. local time_delay = 0.1
  21. local jump_multiplier = 1.5 -- set to 1 for a normal double jump, increase for the second jump to be higher
  22.  
  23. function onJumpRequest()
  24. if not character or not humanoid or not character:IsDescendantOf(workspace) or humanoid:GetState() == Enum.HumanoidStateType.Dead then
  25. return
  26. end
  27.  
  28. if canDoubleJump and not hasDoubleJumped then
  29. hasDoubleJumped = true
  30. humanoid.JumpPower = oldPower * jump_multiplier
  31. humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
  32. end
  33. end
  34.  
  35. local function characterAdded(new)
  36. character = new
  37. humanoid = new:WaitForChild("Humanoid")
  38. hasDoubleJumped = false
  39. canDoubleJump = false
  40. oldPower = humanoid.JumpPower
  41.  
  42. humanoid.StateChanged:connect(function(old, new)
  43. if new == Enum.HumanoidStateType.Landed then
  44. canDoubleJump = false
  45. hasDoubleJumped = false
  46. humanoid.JumpPower = oldPower
  47. elseif new == Enum.HumanoidStateType.Freefall then
  48. wait(time_delay)
  49. canDoubleJump = true
  50. end
  51. end)
  52. end
  53.  
  54. if player.Character then
  55. characterAdded(player.Character)
  56. end
  57.  
  58. player.CharacterAdded:connect(characterAdded)
  59. UIS.JumpRequest:connect(onJumpRequest)
  60. end
  61. end)
  62. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement