I want to check to see if certain teams have no players and if they don't have any players, then make the console print something. Any help?
✓ ANSWER ACCEPTED
How can I check to see if certain teams have no players on them?
1 answer
✓ Accepted answer
teams have a :GetPlayers() function which returns a list of players on that team. You can get the length of any list by putting a # before it.
local team = game.Teams.TEAM_NAME_HERE
local players = team:GetPlayers()
local number_of_players = #players
if number_of_players == 0 then
print("team has no players!")
end
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
Tried running it and it doesn't print anything.
Oh sorry, I messed up on line 5. Should be if number_of_players == 0
Oh thanks.