Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Map command broken?

Asked by 9 years ago
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?

0
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. UserOnly20Characters 890 — 9y
0
Dat tabbing through. EzraNehemiah_TF2 3552 — 9y

1 answer

Log in to vote
0
Answered by
jman116 10
9 years ago

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
Ad

Answer this question