I'm trying to make an FPS game that has team balance
Well, to do this then you can make a table for each TeamColor, iterate through the players and insert them into a table corresponding to their TeamColor, and then check the number of indexes in each table.
(Sorry I couldn't explain this better..)
Example;
local red = {} --Red team local blue = {} --blue team local green = {} --green team --Sort the players-- for i,v in pairs(game.Players:GetPlayers()) do --Check teamcolor, and sort accordingly-- if v.TeamColor == game.Teams.Red.TeamColor then table.insert(red,v) --Sort player elseif v.TeamColor == game.Teams.Blue.TeamColor then table.insert(blue,v) elseif v.TeamColor == game.Teams.Green.TeamColor then table.insert(green.v) end end --Check amount of indexes-- local numRed = #red local numBlue = #blue local numGreen = #green print("There are "..tostring(numRed).." players on the Red team") print("There are "..tostring(numBlue).." players on the Blue team") print("There are "..tostring(numGreen).." players on the Green team")