Code in question:
local mapPos = game.Workspace.MapPosition
local mapRotation = game:GetService("ReplicatedStorage"):WaitForChild("Maps")
local intermissionTimer = 10
local gameTimer = 50
local gameActive = false
local timeMulti = 1
--Intermission phase
while true do
print("Intermission")
repeat
intermissionTimer = intermissionTimer - 1
print(intermissionTimer)
task.wait(1)
until intermissionTimer <= 0
print("Round needs to start")
local randomMap = mapRotation:GetChildren()[math.random(1, #mapRotation:GetChildren())]
clonedMap = randomMap:Clone()
clonedMap:SetPrimaryPartCFrame(mapPos.CFrame)
clonedMap.Parent = game.Workspace.CurrentMap
local mapName = clonedMap:GetAttribute("MapName")
print("Map Selected: "..mapName)
task.wait(2)
playersAlive = {}
playersWon = {}
for i, player in pairs(game.Players:GetPlayers()) do
table.insert(playersAlive, player.Name)
player.Character.HumanoidRootPart.CFrame = clonedMap.SpawnPart.CFrame
end
gameActive = true
repeat
print("Game in progress")
gameTimer -= 1
print(gameTimer)
task.wait(1 * timeMulti)
until gameTimer == 0
clonedMap:Destroy()
for i, player in pairs(playersAlive) do
game.Players[player].Character.HumanoidRootPart.CFrame = game.Workspace.SpawnLocation.CFrame
end
gameActive = false
gameTimer = 10
intermissionTimer = 10
end
Any room for improvement?