How do u check how much people are on a team

how do u check how much players are on a team?

1 Like
local teams = game:GetService("Teams")

local playerCountTeam = teams["YourTeamName"]:GetPlayers()

print(#playerCountTeam)

or try

local teams = game:GetService("Teams")

local playerCountTeam = teams["YourTeamName"]

print(#playerCountTeam)

Didnt try both

function checkplrs(team: Instance)
local p = 0 -- players on team so far
for _,v in pairs(game.Players:GetChildren) do

if v.Team == team then
p +=1
end

end
return p -- returns the amount of players on a team
end
3 Likes

You’ll need to use to :GetPlayers() method from the Teams Class and then use the length operator (#) to print out the number of players on the team.

Example:

local Teams = game:GetService("Teams") -- Define the Teams Service

local teamPlayers = Teams["Team Name Here"]:GetPlayers() -- Use the GetPlayers Method to get all the players on the team

print(#teamPlayers) -- Use the length operator to print out the number of players on the team

I hope this helped you :slight_smile:

15 Likes