How do you set a player jump force to a leaderstat, ex: "JumpPower"?

I’m sorry for writing this but i am making a game and i’m searching for a solution
. If i was not clear enough in the title, i’ll explain it here: when a roblox character jump it can go a certain height and then falls how can i make the height of the jump the same as a leaderstat? Thank you guys.

Here’s a simple piece of code that should do the trick; All I did was set up the leaderstats, set the humanoid’s JumpPower property to the value of the Value variable, then everytime the value changes, I also change the humanoid’s JumpPower again.

game.Players.PlayerAdded:Connect(function(Player)
	local Character = Player.Character or Player.CharacterAdded:Wait()
	local Humanoid = Character:WaitForChild("Humanoid")

	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = Player

	local Value = Instance.new("IntValue")
	Value.Name = "Value"
	Value.Value = 0
	Value.Parent = leaderstats
	
	Humanoid.JumpPower = Value.Value

	Value.Changed:Connect(function(NewNumber)
		Humanoid.JumpPower = NewNumber
	end)
end)
3 Likes

Holy thank you so much dude i appreciate it :+1:

1 Like

Beat me to it, lol. But yeah, this should work just fine

2 Likes