Heres My Script
local status = game.ReplicatedStorage:WaitForChild("Status")
local players = game.Players:GetChildren()
local maps = game.Lighting.Maps:GetChildren()
local currentmap = game.Workspace:WaitForChild("CurrentMap")
local chosenmap = script:WaitForChild("ChosenMap")
local spawner = game.Workspace:WaitForChild("Spawn")
local choices = {}
--Choose a random map
function choosemap()
for i = 1,#maps do
if maps[i]:isA("Model")then
table.insert(choices,maps[i])
end
end
local picked = math.random(1,#maps)
chosenmap.Value = choices[picked].Name
end
--Load the map
function loadMap()
local map = game.Lighting.Maps:FindFirstChild(chosenmap.Value)
map:Clone().Parent = currentmap
end
--Delete the map
function deleteMap()
for i,v in pairs(currentmap:GetChildren())do
if v:isA("Model") then
v:Destroy()
end
end
end
--Teleport all the players
function teleportPlayers()
for i,v in pairs(players)do
v.Character.HumanoidRootPart.CFrame = currentmap:FindFirstChild(chosenmap.Value).Spawn.CFrame * CFrame.new(math.random(5,10),0,math.random(5,10))
end
end
--Teleport back the players
function teleportBack()
for i,v in pairs(players)do
v.Character.HumanoidRootPart.CFrame = spawner.SpawnLocation.CFrame * CFrame.new(math.random(5,10),0,math.random(5,10))
end
end
--The whole cycle
while true do
status.Value = "Choosing Map..."
wait(3)
choosemap()
status.Value = "Chosen Map: "..chosenmap.Value
loadMap()
wait(2)
status.Value = "Teleporting Players.."
wait(5)
teleportPlayers()
wait(60)
deleteMap()
teleportBack()
end

3 comments
Spawn is probably not in the workspace. By "Infinite yield possible" it means that there is a chance :WaitForChild() will wait forever
just put game.Workspace.Spawn
this error puzzled me i always thought it was that hack i encountered in a game. The hack was called Infinite yeild