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?
use this command: break it will stop a for loop, while true do, ect. Example:
x = 5 while true do if x = 5 then print("yay") elseif x = 1 then break end