I have absolutely no clue on how to do this, I have ask multiple people on the scripting Fourms and no one can give me absolute help. I want to know how to split the players in half so if I have 9 people there are 5 people on 1 team and 4 on the other team. I literally have 0 clue how to do this. Please help me!
If you have simply two teams, you can use a bool switch. This is just a value that you will turn on and off while iterating through all your players. You check it to decide which team the current player will be assigned to.
ex;
local bool = false; --It's off rn local players = game.Players:GetPlayers() --This is your table of players local team1 = game.Teams.Team1 --This is your first team local team2 = game.Teams.Team2 --This is your second team --Now, iterate through your table. for _,v in next,players do bool = not bool --Switch the bool! --Now, check the current value to decide the team. if bool then v.TeamColor = team1.TeamColor else v.TeamColor = team2.TeamColor end end
If you want to reduce the code even more, apply some statement logic :D
for _,v in next, players do bool = not bool v.TeamColor = ((bool1 and team1.TeamColor) or team2.TeamColor) end