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

How do I access children inside of PlayerGui with ServerScript?

This doesn't work.

game.Players.PlayerAdded:connect(function(plr)
	value = plr.PlayerGui:WaitForChild("RankGui").Rank.Value
end)

Instead, it just keeps waiting for RankGui. If I didn't put WaitForChild, then it would error and say, RankGui is not valid member of PlayerGui, and the RankGui is on my screen!!!

1 answer

✓ Accepted answer

Don't

If the FilteringEnabled property of Workspace is not enabled, you should already be able to do this. If it is enabled, you will not be able to access the members of the PlayerGui (Assuming they came from StarterGui or were cloned by a LocalScript)

For security's sake you should not put Value objects in GUIs unless they don't mean anything as you should assume the player can change it. Remember: never trust the client.


Anyways, here's how you could do it with a RemoteFunction:

  • Create a RemoteFunction and put it in ReplicatedStorage
  • Have a local script set up the OnClientInvoke callback
  • And then return the value, so then in the server you can call InvokeClient with the player you want.

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