I want to make players get randomly assigned to teams. I have one script for this, but its not really that good. Is there a better way to do this? Here is my script:
local assign = 1 for i,v in pairs(game.Players:GetChildren()) do if assign = 1 then assign = 2 v.Team.BrickColor = BrickColor.new("Black") else assign = 1 v.Team.BrickColor = BrickColor.new("White") end
I hope this works for you, because it worked for me.
for key, value in pairs(game.Players:GetChildren()) do local TeamAssign = math.random(1, 3) --custom amount of teams if TeamAssign == 1 then value.TeamColor = BrickColor.new("Bright red")--your team here elseif TeamAssign == 2 then value.TeamColor = BrickColor.new("Bright blue") --your team here elseif TeamAssign == 3 then value.TeamColor = BrickColor.new("Bright green")--your team here end end
Here you go. Make sure that every team you put in this script exists in your game. Sincerely, DominusInfinitus