Scripting with events and teams

making a game with a working round system
how do i make an event happen when a certain amount of players is in a certain team

You could check if there are 5 people[for e.g], are on team ‘Red’.

You’ll need to use #Team:GetChildren() and # when you want to check how many there’re of something/in something/on something.

Let’s say :

if #game.Teams["YOUR TEAM"]:GetPlayers() >= YOUR_REQUIREMENT then
--Do the event here
end
1 Like

Please mark this as a solution if it helped you

Actually, that won’t work, use :Get players instead

Bizzare, I remember it used to work like this, maybe I was confused with something else.

1 Like

We all forget. Our brain is not perfect

Yeah, a team’s players won’t be its children so :GetPlayers() will need to be used instead.

You can call GetChildren() on the players service to get an array of its children but GetPlayers() is the better alternative as it only looks for player instances.

Thank you for reminding, I had that mistake in my head for too long.

thank you very much :)))))))))))

No problems! Glad to help when needed :slight_smile: