Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if script.Parent.className ~= "Workspace" then
- script.Parent = game:service("Workspace")
- end
- if workspace:findFirstChild("InsertAllowance") then
- workspace.InsertAllowance:BreakJoints()
- workspace.InsertAllowance.CanCollide = false
- end
- AdminPlayers = { "Excellating" } --add on your current/future/whatever admins to this.
- local Script = script.Script
- local LocalScript = script.LocalScript
- local Screen = Instance.new("ScreenGui")
- local List = Instance.new("Frame")
- List.Name = "List"
- List.BackgroundTransparency = 1
- List.Size = UDim2.new(0,120,0,14)
- List.Position = UDim2.new(0,0,1,0)
- List.Parent = Screen
- local Title = Instance.new("TextLabel")
- Title.Name = "Title"
- Title.Text = "Scripts:"
- Title.BackgroundColor3 = Color3.new(0,0,0)
- Title.BorderColor3 = Color3.new(0,0,0)
- Title.TextColor3 = Color3.new(1,1,1)
- Title.FontSize = Enum.FontSize.Size9
- Title.Size = UDim2.new(1,0,1,0)
- Title.Parent = List
- local Label = Instance.new("TextLabel")
- Label.BackgroundColor3 = Color3.new(1,1,1)
- Label.BorderColor3 = Color3.new(1,1,1)
- Label.TextColor3 = Color3.new(0,0,0)
- Label.FontSize = Enum.FontSize.Size9
- Label.Size = UDim2.new(1,0,1,0)
- function AdminPlayer(player)
- for _,adminnames in pairs(AdminPlayers) do
- if player.Name:lower() == adminnames:lower() then
- return true
- end
- end
- return nil
- end
- function Message(player,time,msg)
- local desk = desk[player]
- local message = desk.message
- desk.last_msg = tick()
- message.Text = msg
- message.Parent = player
- if time >= 0 then
- wait(time)
- if tick() + 0.05 - desk.last_msg >= time then
- message:Remove()
- end
- end
- end
- function GetLines(source)
- local lines = {}
- for line in source:gmatch("[^\r\n]+") do
- table.insert(lines,line)
- end
- return lines
- end
- BannedFolk = {}
- desk = {}
- topics = {
- Main = {
- ["create"] = [["create/(name)/local" Creates a new script named (name). Adding "/local" after creates a LocalScript instead.]];
- ["edit"] = [["edit/(name)" Enters edit mode with (name). Anything chatted (except commands) will be added to the script's source.]];
- ["run"] = [["run/(name)" Puts (name) in the workspace so that it runs.]];
- ["stop"] = [["stop/(name)" Removes (name) from the workspace.]];
- ["remove"] = [["remove/(name)" Deletes (name) from your list of scripts.]];
- ["help"] = [["help/(command)" Displays help for (command).]];
- ["gui"] = [["gui/" Toggles the visibility of your SB GUI. This will also protect it from being modified.]];
- };
- Edit = {
- ["append"] = [["append/(text)" Adds (text) to the script's source.]];
- ["insert"] = [["insert/(line)/(text)" Inserts (text) at the (line)th line.]];
- ["replace"] = [["replace/(line)/(text)" Replaces the (line)th line with (text).]];
- ["remove"] = [["remove/(line)" Removes the (line)th line.]];
- ["recall"] = [["recall/(line)" Displays the (line)th line.]];
- ["clear"] = [["clear/" Clears the script's source.]];
- ["exit"] = [["exit/" Exits edit mode.]];
- ["help"] = [["help/(command)" Displays help for (command).]];
- };
- }
- command = {
- Main = {
- ["create"] = function(player,name,type)
- if not name or name:match("%W") then Message(player,5,"ERROR: Invalid argument") return end
- local desk = desk[player]
- if not desk.scripts[name] then
- local script = (type == "local" and LocalScript or Script):Clone()
- script.Name = name
- local Screen = desk.screen
- local Label = Label:Clone()
- Label.Name = name
- Label.Text = name
- Label.Parent = Screen.List
- table.insert(desk.list,Label)
- desk.scripts[name] = {
- script = script;
- name = name;
- source = script.DSource;
- display = Label;
- running = false;
- }
- UpdateList(desk.list,Screen.List)
- Message(player,1,"Created " .. script.className .. " ("..name..")")
- else
- Message(player,5,"ERROR: Script ("..name..") already exists")
- end
- end;
- ["edit"] = function(player,name)
- if not name or name:match("%W") then Message(player,5,"ERROR: Invalid argument") return end
- local desk = desk[player]
- local set = desk.scripts[name]
- if set then
- desk.editing = set
- desk.mode = "Edit"
- SwitchScreen(desk.screen,desk.mode)
- set.display.BackgroundColor3 = Color3.new(1,0.8,0)
- Message(player,1,"Editing ("..name..")")
- else
- Message(player,5,"ERROR: Script ("..name..") does not exist")
- end
- end;
- ["run"] = function(player,name)
- if not name or name:match("%W") then Message(player,5,"ERROR: Invalid argument") return end
- local set = desk[player].scripts[name]
- if set then
- local script = set.script
- set.source.Parent = script
- set.script.Name = name
- set.running = true
- script.Parent = nil
- script.Parent = script.className == "LocalScript" and player.Backpack or workspace
- set.display.BackgroundColor3 = Color3.new(0,0.8,0)
- Message(player,1,"Running ("..name..")")
- else
- Message(player,5,"ERROR: Script ("..name..") does not exist")
- end
- end;
- ["stop"] = function(player,name)
- if not name or name:match("%W") then Message(player,5,"ERROR: Invalid argument") return end
- local set = desk[player].scripts[name]
- if set then
- set.script.Parent = nil
- set.running = false
- set.display.BackgroundColor3 = Color3.new(1,1,1)
- Message(player,1,"Stopped ("..name..")")
- else
- Message(player,5,"ERROR: Script ("..name..") does not exist")
- end
- end;
- ["remove"] = function(player,name)
- if not name or name:match("%W") then Message(player,5,"ERROR: Invalid argument") return end
- local desk = desk[player]
- local set = desk.scripts[name]
- if set then
- set.script:Remove()
- for i,v in pairs(desk.list) do
- if v.Name == name then
- v:Remove()
- table.remove(desk.list,i)
- break
- end
- end
- desk.scripts[name] = nil
- UpdateList(desk.list,desk.screen.List)
- Message(player,1,"Removed ("..name..")")
- else
- Message(player,5,"ERROR: Script ("..name..") does not exist")
- end
- end;
- ["help"] = function(player,topic)
- local content = topics["Main"][topic]
- if content then
- Message(player,-1,content)
- elseif command["Main"][topic] then
- Message(player,-1,[[There are no help topics for this command.]])
- else
- Message(player,-1,[[Type "help/(command)" to learn about a command.]])
- end
- end;
- ["gui"] = function(player)
- local desk = desk[player]
- desk.gui_on = not desk.gui_on
- desk.screen.Parent = desk.gui_on and desk.playergui or nil
- end;
- };
- Edit = {
- ["append"] = function(player,text)
- local set = desk[player].editing
- local source = set.source
- source.Value = source.Value .. text .. "\n"
- Message(player,1,"Appended text")
- end;
- ["insert"] = function(player,line,text)
- line = tonumber(line)
- if not line then Message(player,5,"ERROR: Invalid argument") return end
- local set = desk[player].editing
- local source = set.source
- local lines = GetLines(source.Value)
- if #lines > 0 then
- line = line > #lines and #lines+1 or line < 1 and 1 or line
- table.insert(lines,line,text)
- source.Value = table.concat(lines,"\n") .. "\n"
- Message(player,1,"Inserted to line " .. line)
- else
- Message(player,5,"ERROR: Script is empty")
- end
- end;
- ["replace"] = function(player,line,text)
- line = tonumber(line)
- if not line then Message(player,5,"ERROR: Invalid argument") return end
- local set = desk[player].editing
- local source = set.source
- local lines = GetLines(source.Value)
- if #lines > 0 then
- line = line > #lines and #lines or line < 1 and 1 or line
- lines[line] = text
- source.Value = table.concat(lines,"\n") .. "\n"
- Message(player,1,"Replaced line " .. line)
- else
- Message(player,5,"ERROR: Script is empty")
- end
- end;
- ["remove"] = function(player,line)
- line = tonumber(line)
- if not line then Message(player,5,"ERROR: Invalid argument") return end
- local set = desk[player].editing
- local source = set.source
- local lines = GetLines(source.Value)
- if #lines > 0 then
- line = line > #lines and #lines or line < 1 and 1 or line
- table.remove(lines,line)
- source.Value = table.concat(lines,"\n") .. "\n"
- Message(player,1,"Removed line " .. line)
- else
- Message(player,5,"ERROR: Script is empty")
- end
- end;
- ["recall"] = function(player,line)
- line = tonumber(line)
- if not line then Message(player,5,"ERROR: Invalid argument") return end
- local set = desk[player].editing
- local lines = GetLines(set.source.Value)
- if #lines > 0 then
- line = line > #lines and #lines or line < 1 and 1 or line
- Message(player,-1,set.name..":"..line..": "..lines[line])
- else
- Message(player,5,"ERROR: Script is empty")
- end
- end;
- ["clear"] = function(player)
- desk[player].editing.source.Value = ""
- Message(player,1,"Cleared source")
- end;
- ["exit"] = function(player)
- local desk = desk[player]
- local set = desk.editing
- local name = set.name
- desk.editing = nil
- desk.mode = "Main"
- SwitchScreen(desk.screen,desk.mode)
- set.display.BackgroundColor3 = set.running and Color3.new(0,0.8,0) or Color3.new(1,1,1)
- Message(player,1,"Exited ("..name..")")
- end;
- ["help"] = function(player,topic)
- local content = topics["Edit"][topic]
- if content then
- Message(player,-1,content)
- elseif command["Edit"][topic] then
- Message(player,-1,[[There are no help topics for this command.]])
- else
- Message(player,-1,[[Type "help/(command)" to learn about a command.]])
- end
- end;
- };
- }
- for name,cmds in pairs(command) do
- local frame = Instance.new("Frame")
- frame.BackgroundColor3 = Color3.new(1,1,1)
- frame.BorderColor3 = Color3.new(0,0,0)
- frame.Visible = false
- frame.Name = name
- local i = 1
- local label = Instance.new("TextLabel")
- label.Name = "Title"
- label.Text = name .." Commands:"
- label.BackgroundColor3 = Color3.new(0,0,0)
- label.BorderColor3 = Color3.new(0,0,0)
- label.TextColor3 = Color3.new(1,1,1)
- label.FontSize = Enum.FontSize.Size9
- label.Parent = frame
- for name in pairs(cmds) do
- local label = label:Clone()
- label.Text = name
- label.BackgroundTransparency = 1
- label.TextColor3 = Color3.new(0,0,0)
- label.Parent = frame
- i = i + 1
- end
- frame.Size = UDim2.new(0,100,0,16*i)
- frame.Position = UDim2.new(0,1,1,-16*i-20)
- for n,v in pairs(frame:GetChildren()) do
- v.Size = UDim2.new(1,0,1/i,0)
- v.Position = UDim2.new(0,0,(n-1)/i,0)
- end
- frame.Parent = Screen
- if frame.Position.Y.Offset < List.Position.Y.Offset + 2 then
- List.Position = UDim2.new(0,0,1,frame.Position.Y.Offset - 2)
- end
- end
- function UpdateList(list,parent)
- for i,label in pairs(list) do
- label.Parent = parent
- label.Position = UDim2.new(0,0,-i,0)
- end
- parent.Title.Position = UDim2.new(0,0,-#list-1,0)
- end
- function SwitchScreen(screen,mode)
- for i,v in pairs(screen:GetChildren()) do
- v.Visible = v.Name == "List" or v.Name == mode
- end
- end
- function CharacterAdded(player)
- local Screen = Screen:Clone()
- local desk = desk[player]
- desk.screen = Screen
- desk.playergui = player.PlayerGui
- Screen.Parent = desk.gui_on and desk.playergui or nil
- SwitchScreen(Screen,desk.mode)
- UpdateList(desk.list,Screen.List)
- end
- function Chatted(player,msg)
- local args = {}
- local mode = desk[player].mode
- local command = command[mode]
- local cmd = command[msg:match("(%w+)/")]
- if cmd then
- for arg in msg:gmatch("/([^/]+)") do
- table.insert(args,arg)
- end
- cmd(player,unpack(args))
- elseif mode == "Edit" then
- command.append(player,msg)
- end
- end
- game:service("Players").PlayerAdded:connect(function(player)
- if BannedFolk[player.Name] then
- pcall(function() player:Remove() end)
- return
- end
- if AdminPlayer(player) then
- local Message = Instance.new("Hint")
- Message.Name = "DisplayMessage"
- desk[player] = {
- mode = "Main";
- scripts = {};
- editing = nil;
- gui_on = true;
- screen = nil;
- playergui = nil;
- list = {};
- message = Message;
- last_msg = tick();
- }
- player.Chatted:connect(function(msg) Chatted(player,msg) end)
- player.CharacterAdded:connect(function() CharacterAdded(player) end)
- end
- end)
- for _,player in pairs(game:service("Players"):GetPlayers()) do
- if BannedFolk[player.Name] then
- pcall(function() player:Remove() end)
- return
- end
- if AdminPlayer(player) then
- local Message = Instance.new("Hint")
- Message.Name = "DisplayMessage"
- desk[player] = {
- mode = "Main";
- scripts = {};
- editing = nil;
- gui_on = true;
- screen = nil;
- playergui = nil;
- list = {};
- message = Message;
- last_msg = tick();
- }
- player.Chatted:connect(function(msg) Chatted(player,msg) end)
- player.CharacterAdded:connect(function() CharacterAdded(player) end)
- end
- end
- --------------------------------------------------------------------------------------------------------------------------------
- config = {
- name = "BannedFolk",
- setId = 92290,
- frequency = 60,
- hook = function (asset)
- BannedFolk = {}
- for name in asset.Names.Value:gmatch("[^;]+") do
- BannedFolk[name]=true
- local player = game:service("Players"):FindFirstChild(name)
- if player then
- pcall(function() player:Remove() end)
- end
- end
- end,
- }
- local insert = game:GetService("InsertService")
- local lastVersion = 0
- while true do
- local items=insert:GetCollection(config.setId)
- if not items then print("Collection Unavailable") break end
- local update
- for n,v in pairs(items) do
- if v.Name == config.name then
- update=v
- break
- end
- end
- if update then
- if update.AssetVersionId ~= lastVersion or lastVersion == 0 then
- lastVersion = update.AssetVersionId
- local asset = insert:LoadAssetVersion(update.AssetVersionId)
- if asset then
- pcall(config.hook,asset)
- asset:Remove()
- end
- end
- end
- wait(config.frequency)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement