Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

count the number of players on a certain team?

Asked by 8 years ago

Okay, so I have a team called "Team1", I want to make it so that if the number of players on "Team1" are greater than 9 then the game would create a new team called "Team2". How would I do that?

1 answer

Log in to vote
1
Answered by 8 years ago

I would employ a loop. If you get all the players (game.Players:GetChildren()) and then loop over that list, you can count how many players are on a team. The TeamColor property of the Player objects will indicate what team they are on. You can then use the loop to sum up how many players are on a specific color team.

Ad

Answer this question