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

This script wont work?

game.Players.PlayerAdded:connect(function(plr)
	if plr then
		plr.PlayerGui.Cash.TextLabel.Text = "100$"
	end
end)

1 answer

✓ Accepted answer

The problem here is that the items inside of plr have not loaded yet because the player was just created. Use WaitForChild to wait for them to load:

game.Players.PlayerAdded:connect(function(plr)
	plr:WaitForChild("PlayerGui"):WaitForChild("Cash"):WaitForChild("TextLabel").Text="$100"
end)

3 comments

0

Does not work

0

It won't work offline because players are created before scripts run. It does work online.

0

There should really be an entire article devoted to why people should be using client and server tests over the Play Solo feature. I've seen so many issues arise from people giving Play Solo merit. It's about as powerful as the command bar, except with a termination option.

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