Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Script not made by me
- --Credits: https://www.youtube.com/watch?v=8XBrl484_fs
- local UIS = game:GetService("UserInputService")
- local player = game.Players.LocalPlayer
- local character
- local humanoid
- local canDoubleJump = false
- local hasDoubleJumped = false
- local oldPower
- local time_delay = 0.2
- local jump_multiplier = 1 -- set to 1 for a normal double jump, increase for the second jump to be higher
- function onJumpRequest()
- if not character or not humanoid or not character:IsDescendantOf(workspace) or humanoid:GetState() == Enum.HumanoidStateType.Dead then
- return
- end
- if canDoubleJump and not hasDoubleJumped then
- hasDoubleJumped = false
- humanoid.JumpPower = oldPower * jump_multiplier
- humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
- end
- end
- local function characterAdded(new)
- character = new
- humanoid = new:WaitForChild("Humanoid")
- hasDoubleJumped = false
- canDoubleJump = false
- oldPower = humanoid.JumpPower
- humanoid.StateChanged:connect(function(old, new)
- if new == Enum.HumanoidStateType.Landed then
- canDoubleJump = false
- hasDoubleJumped = false
- humanoid.JumpPower = oldPower
- elseif new == Enum.HumanoidStateType.Freefall then
- wait(time_delay)
- canDoubleJump = true
- end
- end)
- end
- if player.Character then
- characterAdded(player.Character)
- end
- player.CharacterAdded:connect(characterAdded)
- UIS.JumpRequest:connect(onJumpRequest)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement