So I have a script, that I want to make assign teams evenly. I can't use math.random, as that would assign randomly. I want teams to be assigned evenly and randomly. Here is the script I use for random:

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