Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

I cannot change the player's jumppower?

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.

2 answers

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)

1 comment

0

Workspace.Script:4: attempt to index field 'JumpPower' (a number value)

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

2 comments

0

also use Connect instead of connect cause connect is deprecated

0

Where should I put the script in? Workspace or StarterPlayer? LocalScript or Normal Script?

This discussion is preserved as it was. New answers, comments, and votes are closed.