Jumping won't turn back on

Greetings,

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):

image

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?

5 Likes

Where is the script located? (chars)

1 Like

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

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        character:WaitForChild("Humanoid").JumpPower = 7.3 
    end)
end)

2 Likes

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.

I put it inside a ProximityPrompt (if that’s what you’re asking).

I tried something similar and it doesn’t seem to work.

May i see the whole script to further assist you

I know it’s bad but it gets the job done lol

Maybe try this?

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.)

1 Like

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’.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.