JumpHeight property going back to default when changed

I am trying to make a system where whenever you touch a button, the jumpheight property in the humanoid goes up. But when i change the property it goes back to default and starts counting from there.

client side code:

local rs = game:GetService("ReplicatedStorage")
local remotevent = rs.StatsIncrease
JUMPHEIGHT_INCREASE = 0.05
script.Parent.MouseEnter:Connect(function()
end)

script.Parent.MouseButton1Click:Connect(function() 
	remotevent:FireServer(JUMPHEIGHT_INCREASE)
end)

server side code:

local rs = game:GetService("ReplicatedStorage")
local remotevent = rs.StatsIncrease

remotevent.OnServerEvent:Connect(function(player, JUMPHEIGHT_INCREASE)
	player.Character.Humanoid.JumpHeight += JUMPHEIGHT_INCREASE
end)

script that forces 1 jumpheight when they spawn in:

local char = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait() 
char:WaitForChild("Humanoid").JumpHeight = 1

Instead of manually setting Humanoid.JumpHeight to 1 from a LocalScript right away, you can update the StarterPlayer.CharacterJumpHeight property to the desired value while editing the game (not via a script) so that the game will automatically handle that from the server side every time a player’s Character spawns in.

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