iirc the teams object doesn't actually have any children, so there's no way to use the object itself to get the number of players
try doing this:
local numRedPlayers = 0;
for i, v in pairs(game.Players:GetChildren()) do
if v.TeamColor == game.Teams.Red.TeamColor then
numRedPlayers = numRedPlayers + 1;
end;
end;
if numRedPlayers == 0 then
print("Blue has won!");
end;
--[[alternatively,
for i, v in pairs(game.Players:GetChildren()) do
if v.TeamColor == game.Teams.Red.TeamColor then
break
print("Blue team hasn't won yet!");
end;
end;]] |