Admins = {"groovydino", "Player1", "Player","dragonmaster4111"}
game.Players.PlayerAdded:connect(function(player)
player.Chatted:connect(function(msg)
for i,v in pairs(Admins) do
if msg:sub(1,5) == ":map " then
for i,v in pairs(game.Workspace:GetChildren()) do
if v.Name == "Big Fields" or v.Name == "Polar Regions" or v.Name == "Mountains" then
v:Destroy()
end
for i,v in pairs(game.ServerStorage:GetChildren()) do
if string.find(v.Name, string.sub(msg, 6)) ~= nil then
local msg = Instance.new("Hint",workspace)
msg.Text = "An admin is changing the map to: "..v.Name..". (Teleport might repeat, also might lag)"
wait(2)
local map = v:Clone()
map.Parent = game.Workspace
end
for i,v in pairs(game.Players:GetChildren()) do
v.Character:MoveTo(map.TeleportBase1.Base.Position)
msg:Destroy()
end
end
end
end
end
end)
end)
So, I have a problem with this map command. On the last few lines of the script, it says at the :MoveTo part, that 'map' is unknown. I tried removing the end, and that worked, but then what would stop the 'for' loop above it?
What should I do?

2 comments
From what I see, you have the right number of ends in your script so I presume one of those ends will stop the for loop.
Dat tabbing through.