I have a script that is going to put even amount of people in each team, but there is a problem when i am the only player in the game i go into red, when there is 2 people only 1 person goes into blue and the other person in the neutral team. Every time a person gets into a team it adds a person to a IntValue called "Red" and "Blue" and it shows that there is 1 person in Red and Blue value help?
function ScrambleTeam() for i = 1,game.Players.NumPlayers do wait() local c = game.Players:GetChildren() local r = math.random(1,game.Players.NumPlayers) PersonChose = nil for i = 1,#c do if i == r then local items = game.Players:GetChildren() for i,k in pairs(items) do if k.ClassName == "Player" then if k.TeamColor == BrickColor.new("Medium stone grey") then end end end if game.Workspace.GameInfo.Red.Value == game.Workspace.GameInfo.Blue.Value then print("good") -- the print plays PersonChose = c[i] PersonChose.TeamColor = BrickColor.new("Bright red") game.Workspace.GameInfo.Red.Value = game.Workspace.GameInfo.Red.Value + 1 elseif game.Workspace.GameInfo.Red.Value > game.Workspace.GameInfo.Blue.Value then print("good2") -- the print plays PersonChose = c[i] PersonChose.TeamColor = BrickColor.new("Bright blue") game.Workspace.GameInfo.Blue.Value = game.Workspace.GameInfo.Blue.Value + 1 end end end end end wait(60) ScrambleTeam()