This script is meant to update the player list ( much like in COD lobbies ) when a new player joins. However it says that ScreenGui is not a child of PlayerGui despite it definitely being there. Any idea whats going on?
game.Players.PlayerAdded:Connect(function(plr)
plr:WaitForChild("PlayerGui"):WaitForChild("ScreenGui")
for i,v in pairs(game.Players:GetChildren()) do
local ptclone = game.ServerStorage.PlayerTemplate:Clone()
ptclone.Parent = v.PlayerGui.ScreenGui.MainMenu.Multiplayer.Players
ptclone.Name = plr.Name
ptclone.PlayerName.Text = plr.Name
end
end)
When I use wait(5) ( to see if its just acting like this because the player isn't fully loaded in )
17:57:18.348 - ScreenGui is not a valid member of PlayerGui
When I use :WaitForChild("ScreenGui")
17:55:56.771 - Infinite yield possible on 'Players.Player2.PlayerGui:WaitForChild("ScreenGui")'
NOTE: This works in quick test play, but doesn't work when I use the test tab to start a server.

3 comments
i dont think you have the path correct for plr:waitforchild....but i might be wrong
local Players = game:GetService("Players") function onPlayerAdded(player) print(player.Name .. " has entered the game") end --When a player joins, call the onPlayerAdded function Players.PlayerAdded:connect(onPlayerAdded) try something like this
https://wiki.roblox.com/index.php?title=Remote_Functions_%26_Events