Hey guys,
I'm making a round based game that has Elimination. All that's missing is that I need to know how many people there are playing, I separated them in 2 teams. I went on the Wiki onto "Teams" but it did not tell me any functions/properties that give me the number of players in the team.
Can someone please help me? Thanks!
Here, I created this function, I added comments so you can see how it works
function GetPlayersInTeam(Team) local TeamColor = Team.TeamColor --Creating a variable storing the color of the team local PlayersInTeam = 0 --Creating a variable that will store the number of players in the team for _,Player in pairs(game.Players:GetPlayers()) do --Creating a loop that will go through all the players if Player.TeamColor == TeamColor then --Checking if the Player's TeamColor is the same as the team's TeamColor PlayersInTeam = PlayersInTeam + 1 --If it is, adding 1 to the variable we created earlier end end return PlayersInTeam --Returning the amount of players in the team end