How would I do that?
COMMUNITY QUESTION
Checking the players on a team?
2 answers
for _, player in pairs(game.Players:GetPlayers()) do
if player.TeamColor == BrickColor.new("color of the team you want") then
-- do the things you want with player
end
end
If you're trying to get all the players on a given team, you'd do something like this-
function getTeamPlayers( teamColor )
local team = {}
local teamColor = type(teamColor) == "string" and BrickColor.new(teamColor) or teamColor
for _, plr in pairs( Game:GetService("Players"):GetPlayers() ) do
if plr.TeamColor == teamColor then
table.insert(team, plr)
end
end
return team
end
local team = getTeamPlayers("Bright blue")
-- or
local team2 = getTeamPlayers(BrickColor.new("Bright red"))
-- will also work :)
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
What do you mean, are you looking for a certain player, a number of players?