local function getTeamPlayers(teamColor)
local output = {}
for _, player in pairs(game.Players:getPlayers()) do
if (not player.Neutral) and player.TeamColor == BrickColor.new(teamColor) then
table.insert(output, player)
end
end
return output
end
function ButtonClicked()
if getTeamPlayers(script.Parent.BrickColor) <15 then
game.Players.LocalPlayer.TeamColor = BrickColor.new(script.Parent.BrickColor)
-- Here we need a way to kill the player or teleport him to a spawn with the "Bright blue" color (script.Parent.BrickColor)
end
end
script.Parent.ClickDetector.MouseClick:connect(ButtonClicked)
-- 12:02:09.547 - Workspace.Civilians.Button.TeamScript:4: bad argument #1 to 'new' (Color3 expected, got BrickColor)
http://puu.sh/j4Kok/2fb0983031.png
The above comment shows the error it returns in the output. I have no clue what isn't working, as the top function checks amount of players in a team and the second uses it to check if the team has any opening and assigns the player who pressed the button if one exists. Why is it broken and how to fix it?

3 comments
You can't use LocalPlayers in server script (inferring from use of ClickDetector).
Well, damn.
It actually did return an output, if you look in the picture.