I know to find teams it is
game.Teams:GetChildren
But I want to be able to see if a player is on a certain team and then make the number of players on that team into a variable that gives me a number. I would like to ultimately have something like this:
if playersAlive == 1 then -- I would want to put what happens next here
If you can help me it would be much appreciated!
A player has a property named, "TeamColor". In the Teams Service you can name teams and give them a color.
TeamColor is a BrickColor. This is overwritable. So you can change a player's team through a script.
game:GetService("Players").Player1.TeamColor = BrickColor.new("White") --Changes to white print(game:GetService("Players").Player1.TeamColor) --Prints "White".
That is really all there is too it. This is how you can see what teams people are on:
--LocalScript local player = game:GetService("Players").LocalPlayer local teamname = "" for _,color in pairs(game:GetService("Teams")) do if color == player.TeamColor then teamname = color.Name end end print(player.Name.." is on the "..teamname.." team.")
Hope this helps!