Hi. I am trying to make a code. When It's executed, It makes half of the players in red team, other half of the players in blue team. How can I do it?
Here is an example. (It's example only. It isn't working)
function setTeams()
local firstHalf = someCode
local secondHalf = someOtherCode
for i, v in pairs(firstHalf) do
v.TeamColor = BrickColor.new('Bright red')
v:LoadCharacter()
end
for i, v in pairs(secondHalf) do
v.TeamColor = BrickColor.new('Bright blue')
v:LoadCharacter()
end
end
As I said, It's just an example. It isn't working.
How can I do it?

2 comments
put [SOLVED] in your question title
It’s not going to be random though... GetChildren() returns an array sorted by Instances that were parented first. If you run it multiple times most players will probably be in the same team as they were previously.