I need to check if there is no players on a team but I cant find a method to do so.
✓ ANSWER ACCEPTED
Is there anyway to check if there is no children of an object?
1 answer
✓ Accepted answer
Try this:
function getPlayerNumberInTeam(TeamColor)
local num = 0
for index,player in pairs(game.Players:GetChildren()) do
if player.TeamColor == TeamColor and not player.Neutral then
num = num+1
end
end
return num
end
print(getPlayerNumberInTeam(game.Teams.Team.TeamColor))
4 comments
0
- Tab your code 2)
BrickColors are directly comparable. There is no need to usetostring.
0
Typed it in notepad. :P
0
Notepad has tabs. So does the editor on this site.
0
Yeah, sorry. I just decided not to use tabs. I'll fix it.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Players are not children of their team; your title is irrelevant to your question