Hello! I need to disable jumping through a script so it can be toggled on and off. How can I accomplish this?
✓ ANSWER ACCEPTED
How to disable jumping through a script?
3 answers
✓ Accepted answer
You can also use the event UserInputService.JumpRequest.
-- disable jumping
Player.Character.Humanoid.JumpPower = 0
-- or
Player.Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
-- or
game:GetService("UserInputService").JumpRequest:Connect(function()
Player.Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
end)
The most straight forward way is to set the player’s JumpPower to 0, or you can disable the humanoid’s jump state.
--to disable
player.Character.Humanoid.JumpPower = 0
--or
player.Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
--to enable
player.Character.Humanoid.JumpPower = 50
--or
player.Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
The easiest way to do this is to set your JumpPower to 0. You can do this from a script:
Player.Character.Humanoid.JumpPower = 0
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Thanks!