hello i am new to scripting, so i want to change the player of jumppower to the value in the leaderboard. the script looks bad but hope i can get solved
game.Players.PlayerAdded:connect(function(player) while wait(2) do local character = player.Character:WaitForChild("Humanoid") local jumppower = player.leaderstats.Jump.Value character.JumpPower = jumppower end end)
here it is but it is not working. i put it in the workspace. it is a normal script.
You should do this instead.
game.Players.PlayerAdded:connect(function(player) while wait(2) do local character = game.Workspace[player.Name]:WaitForChild("Humanoid") local jumpp0wer = character.JumpPower.Value local jumppower = player.leaderstats.Jump.Value jumppower = = jumpp0wer end end)
This should help:
game.Player.PlayerAdded:Connect(function(plr) plr.CharacterAdded:Connect(function(character) local hum = character:WaitForChild("Humanoid") hum.JumpPower= plr.leaderstats.Jump.Value end) end)
then for better performance instead of using an infinite loop, you can use Changed event for the leaderstats value and then fix jump power