maps = game.Lighting.Maps:GetChildren()
h = Instance.new("Hint", game.Workspace)
player = game.Players.LocalPlayer
while true do
if game.Players.NumPlayers > 1 then
h.Text = "Deciding What Map To Play"
wait(3)
ranGame = math.random(1, #maps)
mapChosen = maps[ranGame]
h.Text = "Map Chosen: " .. mapChosen.Name
wait(3)
mapChosenClone = mapChosen:clone()
mapChosenClone.Parent = game.Workspace
-- Above clones maps and runs with map chosen in hint
local players = game.Players:GetPlayers()
for i = 1, #players do
local player = players[i]
if 1 % 2 == 0 then
player.TeamColor = BrickColor.new("Black")
else player.TeamColor = BrickColor.new("White")
end
end
-- Above is the broken team divider
for i,v in pairs(game.Players:GetPlayers()) do
if v.Character ~= nil then
if v.Character.Humanoid ~=0 then
v.Character.Humanoid.Health = 0
end
end
end
-- Above kills Player
for i = 220, 1, -1 do
h.Text = "Time left: " .. i
wait(1)
wait(1)
end
-- Above is countdown
h.Text = "Game ended"
-- Game ending hint
for i,v in pairs(game.Players:GetPlayers()) do
if v.Character ~= nil then
if v.Character.Humanoid ~=0 then
v.Character.Humanoid.Health = 0
end
end
end
-- Kills player to respawn
local players = game.Players:GetPlayers()
for i = 1, #players do
local player = players[i]
player.TeamColor = BrickColor.new("Medium stone grey")
end
-- Changes players team back to old team
mapChosenClone:Destroy()
else
h.Text = "There needs to be more than 1 player to start"
end
wait(1)
end
-- removes map and if there is less than 2 players it will make the hint say so.
Issue: All players are put on one team Help would be appreciated!

2 comments
Hey, I'm on mobile and can't help tonight but please fix your code indentation to make it easier to read.
That better?