I made a script to wait until there are two people in the server. None of the commands under this if statement are working. Can anyone please point out the problem. Just so you know, this is in a ServerScript in ServerScriptService. Thank you for helping.
local plrs = game.Players:GetPlayers()
local ws = workspace
local gui = game.StarterGui
if #plrs == 1 then --I changed it to 1 so I could test it alone.
print"started"
ws.RedCage:Destroy()
ws.BlueCage:Destroy()
gui.ScreenGui.Frame.PreGame.Visible = false
gui.ScreenGui.Frame.Timer.Visible = true
gui.ScreenGui.Frame.BluePlayer.Visible = true
gui.ScreenGui.Frame.RedPlayer.Visible = true
end
Thank you for your time.

6 comments
PlayerGui, not StarterGui.
Thank you :) I will try
Strange, still doesnt do anything
PlayerGui is parent-ed in Player. In the case there is only one Player, we can do like this to get the PlayerGui: local gui = plrs[1].PlayerGui
https://developer.roblox.com/en-us/api-reference/class/PlayerGui
How could i do that if there are 2 players?