Is there something wrong with this script? It doesnt work for me.
local admins = {"cookieraider1886", "Miofiujh", "ikingnow", "Invisorum", "flamecool000009","master1050devin","iscattered","pirate1flash","marvinthemelon","ausdauer","patheticpopcornman1","xxhappyboyxx","bluepagett","rev66","dignoto","arvizium","mhd100","iTimez2","waysp123"} --Admins here local m = Instance.new("Message") local cmd = "run/" --Change to what you want to start your commands with. Example: This would make you say startObby1. local loading = true local endCmd = "end" --Change to the message you want to say to clear all maps local delaytime = 0 --The number of seconds between the bricks spawning. Set to 0 for the minimum wait time, I think it's a 30th of a second. local currentMap = nil
--Functions function isAdmin(name) --Check if the player is an admin for i,v in pairs(admins) do if name:lower() == v:lower() then return true end end return false end
function loadBricks(map) --Load the bricks
loading = true
local model = Instance.new("Model")
model.Name = map
model.Parent = workspace
local mc = game.ServerStorage[map]:Clone()
for i,v in pairs(mc:GetChildren()) do
if v:IsA("BasePart") then
Workspace.Generator.Connection.Part = v
end
v.Parent = model
wait(delaytime)
end
mc:remove()
Workspace.Generator.Connection.Part = nil
loading = false
end
function removeBricks(map) --Remove the bricks loading = true for i,v in pairs(workspace[map]:GetChildren()) do if v:IsA("BasePart") then Workspace.Generator.Connection.Part = v end wait(delaytime) v:remove() end Workspace.Generator.Connection.Part = nil workspace[map]:remove() loading = false
--Time for the main part game.Players.PlayerAdded:connect(function (player)
repeat wait() until player.Character --Helps prevent glitching if isAdmin(player.Name) then player.Chatted:connect(function (msg) if msg:sub(1,cmdNum) == cmd then --If the first 5 letters of the msg is "start", then local map = msg:sub(cmdNum+1) --map = everything after "start" if game.ServerStorage:FindFirstChild(map) and currentMap == nil then --If there's no map, m.Parent = workspace m.Text = "Loading "..map loadBricks(map) --Load the map currentMap = map m.Text = map.."Map Loaded" wait(3) m.Parent = nil elseif game.ServerStorage:FindFirstChild(map) and currentMap ~= nil then --If there is a map, m.Parent = workspace m.Text = "Loading "..map removeBricks(currentMap) --Remove the current one repeat wait() until loading == false loadBricks(map) --Load the new one repeat wait() until loading == false m.Text = map.."Map Loaded." wait(3) m.Parent = nil currentMap = map end elseif msg == endCmd and currentMap ~= nil then --If the message is the end command, m.Parent = workspace m.Text = "Removing "..currentMap removeBricks(currentMap) --Remove the current map's bricks. repeat wait() until loading == false m.Text = currentMap.."Removed" currentMap = nil wait(3) m.Parent = nil end end) end
end)