I need a script that, when run, will sort only people in a ROBLOX group into two teams. I have tried this, but the issue is that It ends up sorting unevenly.
local players = game.Players:GetPlayers()
for i = 1, #players do
local player = players[i]
if player:IsInGroup(XXXXXX) then
if i >= #players / 2 then
player.TeamColor = BrickColor.new("Really red")
else
player.TeamColor = BrickColor.new("Really blue")
end
end
end

2 comments
Edited to fix code formatting.
You should indent your code correctly.