What would I add to my script to make it so when a team has 0 players it changes the value on InRound

So I know this is probably a bit much but I was very confused, how would I detect the value of how many players are in a team, and then use said value in the script?

local roundLength = 600
local interLeagnth = 35
local inRound = game.ReplicatedStorage:WaitForChild("InRound")
local Status = game.ReplicatedStorage:WaitForChild("Status")
local lobbySpawn = game.Workspace.Lobby.LobbySpawns.Spawns.SpawnLocation
local gameSpawn = game.Workspace.Forest.GameSpawn



inRound.Changed:Connect(function()
	if inRound.Value == true then
		for _, player in pairs(game.Players:GetChildren()) do
			local char = player.Character
			char.HumanoidRootPart.CFrame = gameSpawn.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 = interLeagnth, 1, -1 do
			inRound.Value = false
			wait(1)
			Status.Value = "Intermission ".. i .." seconds left!"
		end
		for i = roundLength, 1, -1 do
			inRound.Value = true
			wait(1)
			Status.Value = "Game: ".. i .." seconds left!"
		print("Clone tools here")
		end
	end
end

spawn(roundTimer)
1 Like

You can use game.Teams.TEAMNAME:GetPlayers() to get the number of players in a team.

1 Like

Ok, I’ll try that when I can, thanks

A simple conditional like so would do well:

if #game.Teams.TEAMNAME:GetPlayers() == 0 then
    inRound.Value = not inRound.Value
end
1 Like