What's wrong with this script?

local mapFolder = game.ServerStorage.Maps
local clock = game.ReplicatedStorage.Clock

local function toMS(s)
return ("%02i:%02i"):format( s/60%60, s%60)
end

while true do
clock.Value = “Intermission: 15!”

local interTime = 15

repeat wait(1)
interTime = interTime - 1
clock.Value = “Intermission: “…interTime…”!”
until interTime == 0
wait(1)
clock.Value = “Selecting a Minigame…”
wait(3)

local mapId = math.random(1, #mapFolder:GetChildren())
local Map = mapFolder:FindFirstChild(“Map”…mapId)

if Map then
clock.Value = “A minigame has been selected”
wait(1)

  local mapName = Map:FindFirstChild("Name")
  if mapName then
  	clock.Value = "The Minigame is: "..mapName.Value
  	wait(1)
  end
  wait(1)
  clock.Value = "Loading minigame..."
  
  local newMap
  newMap = Map:clone()
  newMap.Parent = game.Workspace
  newMap.Name = "Map"
  
  wait(2)
  
  clock.Value = "Teleporting players..."
  if newMap:FindFirstChild("PlayerSpawns")then
  	for i, v in pairs(game.Players:GetPlayers())do
  		local character = workspace:FindFirstChild(v.Name)
  		if character then
  			local root = character:FindFirstChild("HumanoidRootPart")
  			if root then
  				local spawnId = math.random(1, #newMap.PlayerSpawns:GetChildren())
  				local spawnObj = newMap.PlayerSpawns:FindFirstChild("Spawn"..spawnId)
  				if spawnObj then
  					root.Position = spawnObj.Position
  				end
  			end
  		end
  	end
  end

end
end

if game.Workspace.Map:WaitForChild(“Name”).Value == “Gladiator” then
for i = 60,0,-1 do
clock.Value = toMS(i)
wait(1)
end
else if game.Workspace.Map:WaitForChild(“Name”).Value == “Trafficing Trouble” then
for i = 30,0,-1 do
clock.Value = toMS(i)
wait(1)
end
end
game.Workspace.Map:Destroy()
end

1 Like