Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is there anyway to check if there is no children of an object?

I need to check if there is no players on a team but I cant find a method to do so.

1 comment

0

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

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
  1. Tab your code 2) BrickColors are directly comparable. There is no need to use tostring.
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.