This script works even when there's only one person, and I want it to only work when there's greater than or equal to 2. I keep adding scripts to do so, but everytime I do, the GUI stops working. Any help please?
local roundLength = 10 local intermissionLength = 10 local InRound = game.ReplicatedStorage.InRound local Status = game.ReplicatedStorage.Status local LobbySpawn = game.Workspace.Lobby local GameAreaSpawn = game.Workspace.GameArea InRound.Changed:Connect(function() if InRound.Value == true then for _, player in pairs(game.Players:GetChildren()) do local char = player.Character char.HumanoidRootPart.CFrame = GameAreaSpawn.CFrame end else for _, player in pairs(game.Players:GetChildren()) do local char = player.Character char.HumanoidRootPart.CFrame = LobbySpawn.CFrame end end end) local function roundTimer() while wait() do for i = intermissionLength, 0, -1 do InRound.Value = false wait(1) Status.Value = "Intermission: ".. i .." seconds left!" end for i = roundLength, 0, -1 do InRound.Value = true wait(1) Status.Value = "Game: "..i.." seconds left!" end end end spawn(roundTimer)
repeat -- Create a loop to check number of players wait() local numberofplayers = #game.Players:GetChildren() -- Instance:GetChildren() returns a table of all children. You can use # to get the number of items in a table, so combining them into a definition will return the number of children inside the players folder, which is how many players there are. if numberofplayers >= 2 then -- Check if number of players is greater than or equal to 2 spawn(roundTimer) -- if so run function break -- break the repeat loop so it doesn't keep running. end until #game.Players:GetChildren() >= 2