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

My Output says :WaitForChild is nil and I dont understand why?

This is what the output said: 09:54:33.332 - Players.tyorange09.PlayerGui.ScreenGui.StoneShardValue.Script:2: attempt to index nil with 'WaitForChild'

1 comment

0

Here is the code: local player = game.Players.LocalPlayer local Ptats = player:WaitForChild("Pstats") local stone = Ptats:WaitForChild("Stone") local text = script.Parent text.Text = "Stone: "..stone.Value stone:GetPropertyChangedSignal("Value"):Connect(function() text.Text = "Stone: "..stone.Value end)

1 answer

✓ Accepted answer

The issue here is that you are using a Script and not a LocalScript. Simply copy your code and put it inside a LocalScript and your code should work fine. The reason a LocalScript is needed is because regular scripts cannot access the LocalPlayer, which is why you get the error that player is nil.

1 comment

0

Thaanks a million!

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