So I want to make it so after 5 minutes of being on the main map, your are teleported to the lobby, after that a countdown from 60 will begin and at the end of that it will evenly assign teams and teleport you to the map, then after that, countdown from 5 minutes to go back to the lobby, e.t.c, Ive been given this peice of code:
for i = 60, 1, -1 do
status.Value = "Intermission - " .. i
wait(1)
end
wait(2)
status.Value = "Round starting, get ready!"
wait(1)
local list = game.Players:GetPlayers() local Teams = {game.Teams["Red Team"], game.Teams["Blue Team"]}
for _ = 1, #list do
local index = math.random(1, #list) -- randomly choose an index that leads to a player
local player = list[index] -- gets the randomly chosen player
player.Team = Teams[ (#list % 2) + 1 ] -- chooses player's team; explanation below
table.remove(list, index) -- removes the player from the list so that they aren't chosen again
end

2 comments
https://www.youtube.com/watch?v=ESzmiC_AzLw ?
That does not show how to distribute everybody on to an even team and spawn them at the desired team spawn.