Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --https://youtu.be/z0CfDQ9zy0o
- local UserInputService = game:GetService("UserInputService")
- local Players = game:GetService("Players")
- local player = Players.LocalPlayer
- local character = player.Character or player.CharacterAdded:Wait()
- local humanoid = character:WaitForChild("Humanoid")
- local rootPart = character:WaitForChild("HumanoidRootPart")
- local jumpHeight = 100
- local canDoubleJump = false
- local hasDoubleJumped = false
- humanoid.StateChanged:Connect(function(_, newState)
- if newState == Enum.HumanoidStateType.Landed then
- canDoubleJump = false
- hasDoubleJumped = false
- end
- end)
- UserInputService.InputBegan:Connect(function(input, gameProcessed)
- if gameProcessed then return end
- if input.KeyCode == Enum.KeyCode.Space then
- if humanoid:GetState() == Enum.HumanoidStateType.Freefall and canDoubleJump and not hasDoubleJumped then
- hasDoubleJumped = true
- rootPart.Velocity = Vector3.new(rootPart.Velocity.X, jumpHeight, rootPart.Velocity.Z)
- elseif humanoid:GetState() ~= Enum.HumanoidStateType.Freefall then
- canDoubleJump = true
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement