Gui text problem working for server but not client

I’m making a 2 players needed to start script and I tested it out and the gui text stayed the same for the client but when I switched to the server it changed to what I wanted it to. I’m not sure why it didn’t change for me, here’s the code

local Plrcount = game.Players:GetChildren()

if #Plrcount >= 2 then
	--Not done yet
else
	TimerDisplay.Text = "2 players needed to start"
end

Use a PlayerAdded and PlayerRemoving event to update a counter that checks for the number of players.

this can help:

local Players = game:GetService("Players")

while true do
   local plrCount = Players:GetPlayers
   if #plrCount > 1 then
      -- add your code here
   else
      TimerDisplay.Text = "2 players needed to start"
   end
end

to prevent loops:

local Players = game:GetService("Players")
function update()
   local plrCount = Players:GetPlayers()
   if #plrCount > 1 then
      -- add your code here
   else
      TimerDisplay.Text = "2 players needed to start"
   end
end
Players.PlayedAdded:Connect(update)
Players.PlayedRemoving:Connect(update)

also, your script is very dangerous since it has no wait() :laughing:

I tried it out and an error popped up but I fixed it. The gui text is still the same for both the client and the server