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

My Simulation is not Working?

Asked by 10 years ago
maps = {}
admin = {"GingerBiscuit99", "ImTooGoodForThisGame"}

for i,v in pairs (game.Lighting:GetChildren()) do
    if v:IsA("Model") then
        table.insert(maps, v)
    end
end

function chooseMap()
    return maps[math.random(1, #maps)]
end

function loadMap(mg)
    local m = mg:clone()
    script.Current.Value = m.Name
    m.Parent = Workspace
    return m
end

function endMap(m)
    m:remove()
end

game.Players.PlayerAdded:connect(function(nP)
for _,v in pairs(admin) do
if nP.Name == v then
nP.Chatted:connect(function(msg)

if msg == ":map/random" then
    local m = chooseMap()
    local loaded = loadMap(m)

    if msg == ":map/clean" then
    local MapName = tostring(script.Current.Value)
    game.Workspace:FindFirstChild(game.Workspace.MapName):Destroy()

end
end
end)
end
end
end)

There are no Errors in the output/dev console and This does not work. Could you please post what is wrong?

1 answer

Log in to vote
0
Answered by
wazap 100
10 years ago

maps is an empty table lol

Ad

Answer this question