I’m trying to turn on Jumping in my game where jumping has been turned off. These are the properties I have changed to turn off the jumping (JumpPower is set to 0):
And here’s the script I am using to try and bring it back:
game.StarterPlayer.CharacterJumpHeight = 7.3
For some reason, when I run the script (It’s a Server Script), it does not affect anything and I cannot jump. Any way I can fix this?
game.StarterPlayer.CharacterJumpHeight property does not directly affect the jumping ability of the character.you have to get the humanoid and get the jumpower like this humanoid.JumpPower = jumpHeight
I think you can also do this but there might be some mistakes because i wrote this quickly
If you want to enable jumping in the game by default you would have to change it in the game settings in studio.
If you want it off by default but be able to enable it at run-time, you’ll have to iterate through existing players and set each of their jump heights. Modifying the StarterPlayer at run-time won’t affect players who have already spawned in.
ProximityPrompt.Triggered:Connect(function(player)
local h = if (player.Character ~= nil) then player.Character:FindFirstChildOfClass("Humanoid") else nil
if (h ~= nil) then
h.UseJumpPower = false
h.JumpHeight = 7.3
print(player.Name, "jump height set to", h.JumpHeight)
end
end)
(Obviously “ProximityPrompt” would be whatever the path to the prompt is.)
The PlayerAdded event seems useless here. The player object is automatically passed in the Triggered event of ProximityPrompts, so you don’t need to keep track of ‘username’.