Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 2 years ago

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

Log in to vote
0
Answered by
Puppynniko 1059 Moderation Voter
2 years ago
Edited 2 years ago

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

player.CharacterAdded:Wait("PlayerGui")
0
Like this? wDaerkfeX 37 — 2y
0
player.CharacterAdded:Wait() wDaerkfeX 37 — 2y
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. wDaerkfeX 37 — 2y
0
yea player.CharacterAdded:Wait() and localScripts will not work in Server Script Service and you cant access LocalPlayer in a ServerScript Puppynniko 1059 — 2y
View all comments (4 more)
0
So I put the script in starterplayer? wDaerkfeX 37 — 2y
0
yes you make it LocalScript and put into StarterCharacterScripts and remove player.CharacterAdded:Wait() imKirda 4491 — 2y
0
ok thanks a lot! wDaerkfeX 37 — 2y
0
nice Puppynniko 1059 — 2y
Ad

Answer this question