Check for the Ammount of People on a team

Recently I got help on how to add players to a team when roles where picked. how do I make it so then after the wait at the very bottom it can check if a role has 0 people ?
I thought of doing if survivors == 0 then but that didn’t work

#TeamName:GetPlayers()
(limit)

For the #Teamname would I put my team name there and for the limit do i put what number I want to check for?

Keep the hastag, but TeamName should be the game:GetService("Teams").Survivor. #game:GetService("Teams").Survivor:GetPlayers() Will return the number of players on the survivor team, then you can use that however you want.

Could I do “ if #game:GetService(“Teams”).Survivor:GetPlayers() == 0 then “ or would I have to add another line of code?

if #game:GetService(“Teams”).Survivor:GetPlayers() == 0 then
    --What you want it to do here
end
2 Likes

Thank you so much! tested it using a print statement and it works as intended. Thanks!

one more thing you did solve it but is there a way for it to constantly check?

What do you mean by that? (limit)

like will the command just loop or is there something I have to do to make it loop and keep checking if it every hits 0 like over the course of the entire round

Every time someone leaves the team, it will check how many people are left.

local Team = game:GetService(“Teams”).Survivor

Team.PlayerRemoved:Connect(function()
    if #Team:GetPlayers() == 0 then
        --What you want it to do here
    end
end
1 Like