Still have questions? Join our Discord server and get real time help.
3

# Help with updating lobby list (like in COD lobbies)?

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.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.

0
i dont think you have the path correct for plr:waitforchild....but i might be wrong SweetAsCreampie 55 — 2y
0
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 SweetAsCreampie 55 — 2y