I got all the "plrs" in a table and then tried to split them into two. But it doesnt place the players on each team..
plrs = IsOrNotAfkTable(false)
local RedTeam = Instance.new("Team", game:GetService("Teams"))
RedTeam.TeamColor = BrickColor.new("Really red")
RedTeam.Name = "Red"
local Folder = Instance.new("Folder", RedTeam)
Folder.Name = "leaderstats"
local Hits = Instance.new("IntValue",Folder)
Hits.Name = "Hits"
local BlueTeam = Instance.new("Team", game:GetService("Teams"))
BlueTeam.TeamColor = BrickColor.new("Navy blue")
BlueTeam.Name = "Blue"
local Folder = Instance.new("Folder", BlueTeam)
Folder.Name = "leaderstats"
local Hits = Instance.new("IntValue",Folder)
Hits.Name = "Hits"
local redTeam = {}
local blueTeam = {}
local plrsOnEachTeam = math.floor(#plrs / 2)
function Teamer()
for i = 1,plrsOnEachTeam,1 do
table.insert(redTeam,#redTeam + 1,plrs[1])
table.remove(plrs,1)
end
for i =1,plrsOnEachTeam,1 do
table.insert(blueTeam,#blueTeam + 1,plrs[1])
table.remove(plrs,1)
end
--In case there is a leftover player
if #plrs == 1 then
table.insert(redTeam,#redTeam + 1,plrs[1])
table.remove(plrs,1)
end
