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
length = function( tab )
local count = 0 -- increases in accordance with
--number of entries in provided table
for index, value in next, tab do
-- iterates through provided table
count = count + 1
end
return count -- returns total amount of found entries in table `tab`
end
length(getTeamPlayers())
function onClicked()
print "test" -- To test if it even gets up to this point
if (#getTeamPlayers("Bright blue")) < 17 then
print(#getTeamPlayers("Bright blue"))
game.Players.LocalPlayer.TeamColor = BrickColor.new("Bright blue") -- This is the broken line
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
The line to change a player's team isn't working. I have tried lots and lots and things and now I have no idea. How do I change the player who pressed team to Bright blue?

1 comment
Ok, so I've tried that script, and for some reason it still will not work. (I have made it a local script, yes)