Okay so I've already asked a bunch of questions concerning this one script but there always ends up being an error. In this script, the map clones, but then deletes itself from lighting, not allowing you to teleport to it again.. How do I fix it so it will just continuously run and not delete the map from lighting? (Also I would like to thank BlueTaslem for helping me clean and fix this script up! Also keep in mind that I am just beginning to understand scripting so I'm not sure how to fix this..) Thanks for stopping by! Hope you can help! Here is the script:
local Map1 = game.Lighting.Map1
local Map2 = game.Lighting.Map2
local Map3 = game.Lighting.Map3
local Map4 = game.Lighting.Map4
local Map5 = game.Lighting.Map5
local Maps = {
game.Lighting.Map1,
game.Lighting.Map2,
game.Lighting.Map3,
game.Lighting.Map4,
game.Lighting.Map5,
}
LOBBY = Vector3.new(1.915, 915.46, -26.68)
math.randomseed(tick(7))
while true do
wait(5)
local msg = Instance.new("Message")
msg.Parent = nil
msg.Parent = game.Workspace
msg.Text = "Welcome to Zombie Survival! Choosing a map!"
wait(3)
msg:Destroy()
local chosenMap = math.random(1,5)
local map = Maps[chosenMap]
local msg = Instance.new("Message", workspace)
map:Clone(). Parent = game.workspace
msg.Text = "Loading map please wait."
wait(0.5)
msg.Text = "Loading map please wait.."
wait(0.5)
msg.Text = "Loading map please wait..."
wait(0.5)
msg.Text = "Loading map please wait."
wait(0.5)
msg.Text = "Loading map please wait.."
wait(0.5)
msg.Text = "Loading map please wait..."
wait(1)
msg.Text = "Map loaded! Teleporting players..."
wait(1)
msg:Destroy()
for _, player in pairs(game:GetService("Players"):GetPlayers()) do
if player.Character then
player.Character:MoveTo(map.Spawnpos.Position + Vector3.new(0, 5, 0))
wait(10)
end
end
local message = Instance.new("Message", workspace)
message.Text = "Game end... Intermission!"
map:remove()
wait(1)
for _, player in pairs(game:GetService("Players"):GetPlayers()) do
if player.Character then
player.Character:MoveTo(LOBBY)
end
end
message:Destroy()
map:Destroy()
end

2 comments
any errors?
Use ServerStorage. It removes a bit of lag.