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?
