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

ScreenGui is not a valid member of PlayerGui?

Whenever I go onto a server to test my game, it doesn't work. When I checked the server logs, it says "ScreenGui is not a valid member of PlayerGui." and then it directs me to line 162, which is probably this:

for _,v in pairs(game.Players:GetChildren()) do
   	v.PlayerGui.ScreenGui.TextLabel.Text = "You need 1 more player for this to start."
end

1 answer

✓ Accepted answer

If your game has FilteringEnabled on, this wouldn't work because the server can't access the descendants of each clients' gui. If your game's not in FE, a solution has been provided

** For FE Games** You'll need to use a RemoteEvent if FE is enabled for server - client communication

--in a local script in the textlabel

local re = game.ReplicatedStorage:WaitForChild('RemoteEvent')

re.OnClientEvent:Connect(function(t)
        script.Parent.Text = t
end)
--Your server code

local re = game.ReplicatedStorage:WaitForChild('RemoteEvent')

re:FireAllClients('You need 1 more player for this to start.')

** For Non - Fe Games**

If your game doesn't have Fe enabled, you'll probably need to use :WaitForChild on the screen gui, or put a wait() before the rest of the code begins.

1 comment

0

Thanks dude

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