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

PlayerGui is not a valid member of Player?

local equip1 = Player.PlayerGui.Equipped.Ability1:FindFirstChildOfClass("Folder")
if equip1 then

For some reason, this gets the error of "PlayerGui is not a valid member of Player" when running. If anyone knows whats going on please help. Extra notes: This is in a serverscript and happens when saving the inventory. This happens when a player leaves, so the playergui should be there. I tried using waitforchild, but it ended up waiting infinitely.

2 comments

0

player is not identified :man_shrugging:

0

Player is identified earlier, and this is a serverscript not local

2 answers

You have to index the PlayerGui first, and it's children should be already loaded after that. Maybe you also need to index your LocalPlayer before trying to find it's children.

player = game.Players.LocalPlayer -- does fine on a LocalScript
plrGUI = player:WaitForChild("PlayerGui") -- most probrably works
-- below goes whatever you want to find in the playergui

2 comments

0

Its a serverscript and player is already identified

0

You can't interact with GUI's using a serverscript! Transcript it to a LocalScript, which can handle Player-related objects.

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