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

I keep getting the error "Menu is not a valid member of PlayerGui?"

Asked by 5 years ago

Every time I press play I get that error. I have a GUI in PlayerGui named "Menu"

The script:

while wait() do
for _, v in pairs(game.Players:GetChildren()) do
local cont = v.PlayerGui.Menu.Container
cont.GoldVal.Text = v.leaderstats.Gold.Value
cont.LevelVal.Text = v.leaderstats.Level.Value
        end
end

Error output:

22:55:30.705 - Menu is not a valid member of PlayerGui
22:55:30.707 - Stack Begin
22:55:30.708 - Script 'ServerScriptService.Script', Line 3
22:55:30.709 - Stack End
0
It seems that Menu isn't a child of PlayerGui just saying I'm not that good at scripting HappyTimIsHim 652 — 5y
0
Ew don't do it like that. 1. Don't use wait() as a condition. 2. Don't use GetChildren, use GetPlayers. 3. Disregard the last 2 because you shouldn't even be doing it like that. Just update the text on the client using a Changed event. User#19524 175 — 5y
0
The reason your script does not work is because you used a server script. The "Menu" ScreenGui was clones locally into the PlayerGui, the server doesn't see it. User#19524 175 — 5y
1
if you have FE enabled you have to use an event to fire to all the clients from the serverside, see tutorials on remote events jtaraska 1 — 5y

Answer this question