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

Who can help me for a output error message from a script?

Hey I have created this script:

Players = game:GetService("Players")
player = Players.LocalPlayer

player.CharacterAdded:Wait("PlayerGui")
WorldBoost = player:WaitForChild("WorldBoost")
WorldBoostLabel = WorldBoost:WaitForChild("WorldBoostLabel")

WorldBoostLabel.Text = ("JUMP WORLD BOOST: x")..player.WorldBoost.Value

player.WorldBoost.Changed:Connect(function()
	WorldBoostLabel.Text = ("JUMP WORLD BOOST: x")..player.WorldBoost.Value
end)

and when I start the game, in output, I have an error message: " ServerScriptService.WorldBoost_Client:4: attempt to index nil with 'CharacterAdded'" How can I fix that please? Thank in advance!

1 answer

✓ Accepted answer

what is this "PlayerGui" remove it and why is this in a serverscriptService

player.CharacterAdded:Wait("PlayerGui")

8 comments

0

Like this?

0

player.CharacterAdded:Wait()

0

And it's in server script because I had already asked someone who couldn't solve the problem, who asked me to put it in server script services.

0

yea player.CharacterAdded:Wait() and localScripts will not work in Server Script Service and you cant access LocalPlayer in a ServerScript

0

So I put the script in starterplayer?

0

yes you make it LocalScript and put into StarterCharacterScripts and remove player.CharacterAdded:Wait()

0

ok thanks a lot!

0

nice

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