Check the number of players in a team script

As I said in the title, I am trying to check the number of players inside a team. The script doesn’t seem to work, and I’m sure it has a mistake, but the Output doesn’t say anything. Here’s the code:

local players = game.Players:GetChildren()
local count = 0
for i=1,#players do
		if players[i].Character ~= nil then 
		if players[i].TeamColor == BrickColor.new("Shamrock") then
			count = count+1
           workspace.Values.count.Value = count
		end
end
end
2 Likes

you can do this by getting the team object example

Blue = #game.Teams.Blue:GetPlayers()

^^ this returns the number in the blue team

1 Like

Thanks mate! I appreciate your help. :]

1 Like