· 10 years ago · Sep 01, 2016, 10:32 PM
1script.Parent = nil
2local Script = script.Script
3local LocalScript = script.LocalScript
4
5version = "4.0.14";
6
7local Screen = Instance.new("ScreenGui")
8 Screen.Name = "SBGUI"
9 local List = Instance.new("Frame")
10 List.Name = "List"
11 List.BackgroundTransparency = 1
12 List.Size = UDim2.new(0,120,0,14)
13 List.Position = UDim2.new(0,0,1,0)
14 List.Parent = Screen
15 local Title = Instance.new("TextLabel")
16 Title.Name = "Title"
17 Title.Text = "Scripts:"
18 Title.BackgroundColor3 = Color3.new(0,0,0)
19 Title.BorderColor3 = Color3.new(0,0,0)
20 Title.TextColor3 = Color3.new(1,1,1)
21 Title.FontSize = Enum.FontSize.Size9
22 Title.Size = UDim2.new(1,0,1,0)
23 Title.Parent = List
24 local Menus = Instance.new("Frame")
25 Menus.Name = "Menus"
26 Menus.BackgroundTransparency = 1
27 Menus.BorderSizePixel = 0
28 Menus.BackgroundColor3 = Color3.new()
29 Menus.BorderColor3 = Color3.new()
30 Menus.Size = UDim2.new(1,0,1,0)
31 Menus.Parent = Screen
32local Label = Instance.new("TextLabel")
33 Label.BackgroundColor3 = Color3.new(1,1,1)
34 Label.BorderColor3 = Color3.new(1,1,1)
35 Label.TextColor3 = Color3.new(0,0,0)
36 Label.FontSize = Enum.FontSize.Size9
37 Label.Size = UDim2.new(1,0,1,0)
38
39function Output(player,time,msg)
40 local pgui = player:FindFirstChild("PlayerGui")
41 if pgui then
42 local desk = desk[player]
43 local output = desk.output
44 desk.last_msg = tick()
45 output.Text = msg
46 output.Parent = pgui
47 if time >= 0 then
48 wait(time)
49 if tick() + 0.05 - desk.last_msg >= time then
50 output:Remove()
51 end
52 end
53 end
54end
55
56function GetLines(source)
57 local lines = {}
58 for line in source:gmatch("[^\r\n]+") do
59 table.insert(lines,line)
60 end
61 return lines
62end
63
64BannedFolk = {}
65desk = {}
66topics = {
67 Main = {
68 ["create"] = [["create/(name)/local" Creates a new script named (name). Adding "/local" after creates a LocalScript instead.]];
69 ["edit"] = [["edit/(name)" Enters edit mode with (name). Anything chatted (except commands) will be added to the script's source.]];
70 ["run"] = [["run/(name)" Puts (name) in the workspace so that it runs.]];
71 ["stop"] = [["stop/(name)" Removes (name) from the workspace.]];
72 ["remove"] = [["remove/(name)" Deletes (name) from your list of scripts.]];
73 ["help"] = [["help/(command)" Displays help for (command).]];
74 ["gui"] = [["gui/" Toggles the visibility of your SB GUI. This will also protect it from being modified.]];
75 };
76 Edit = {
77 ["append"] = [["append/(text)" Adds (text) to the script's source.]];
78 ["insert"] = [["insert/(line)/(text)" Inserts (text) at the (line)th line.]];
79 ["replace"] = [["replace/(line)/(text)" Replaces the (line)th line with (text).]];
80 ["remove"] = [["remove/(line)" Removes the (line)th line.]];
81 ["recall"] = [["recall/(line)" Displays the (line)th line.]];
82 ["clear"] = [["clear/" Clears the script's source.]];
83 ["exit"] = [["exit/" Exits edit mode.]];
84 ["help"] = [["help/(command)" Displays help for (command).]];
85 };
86}
87command = {
88 Main = {
89 ["create"] = function(player,name,type)
90 if not name or name:match("%W") then Output(player,5,"ERROR: Invalid argument") return end
91 local desk = desk[player]
92 if not desk.scripts[name] then
93 local script = (type == "local" and LocalScript or Script):Clone()
94 script.Name = name
95 local Screen = desk.screen
96 local Label = Label:Clone()
97 Label.Name = name
98 Label.Text = name
99 Label.Parent = Screen.List
100 table.insert(desk.list,Label)
101 desk.scripts[name] = {
102 script = script;
103 name = name;
104 source = script.DSource;
105 display = Label;
106 running = false;
107 }
108 UpdateList(desk.list,Screen.List)
109 Output(player,1,"Created " .. script.className .. " ("..name..")")
110 else
111 Output(player,5,"ERROR: Script ("..name..") already exists")
112 end
113 end;
114 ["edit"] = function(player,name)
115 if not name or name:match("%W") then Output(player,5,"ERROR: Invalid argument") return end
116 local desk = desk[player]
117 local set = desk.scripts[name]
118 if set then
119 desk.editing = set
120 desk.mode = "Edit"
121 SwitchMenus(desk.menus,desk.mode)
122 set.display.BackgroundColor3 = Color3.new(1,0.8,0)
123 Output(player,1,"Editing ("..name..")")
124 else
125 Output(player,5,"ERROR: Script ("..name..") does not exist")
126 end
127 end;
128 ["run"] = function(player,name)
129 if not name or name:match("%W") then Output(player,5,"ERROR: Invalid argument") return end
130 local set = desk[player].scripts[name]
131 if set then
132 local script = set.script
133 set.source.Parent = script
134 set.script.Name = name
135 set.running = true
136 script.Parent = nil
137 script.Parent = script.className == "LocalScript" and player.Backpack or workspace
138 set.display.BackgroundColor3 = Color3.new(0,0.8,0)
139 Output(player,1,"Running ("..name..")")
140 else
141 Output(player,5,"ERROR: Script ("..name..") does not exist")
142 end
143 end;
144 ["stop"] = function(player,name)
145 if not name or name:match("%W") then Output(player,5,"ERROR: Invalid argument") return end
146 local set = desk[player].scripts[name]
147 if set then
148 set.script.Parent = nil
149 set.running = false
150 set.display.BackgroundColor3 = Color3.new(1,1,1)
151 Output(player,1,"Stopped ("..name..")")
152 else
153 Output(player,5,"ERROR: Script ("..name..") does not exist")
154 end
155 end;
156 ["remove"] = function(player,name)
157 if not name or name:match("%W") then Output(player,5,"ERROR: Invalid argument") return end
158 local desk = desk[player]
159 local set = desk.scripts[name]
160 if set then
161 set.script:Remove()
162 for i,v in pairs(desk.list) do
163 if v.Name == name then
164 v:Remove()
165 table.remove(desk.list,i)
166 break
167 end
168 end
169 desk.scripts[name] = nil
170 UpdateList(desk.list,desk.screen.List)
171 Output(player,1,"Removed ("..name..")")
172 else
173 Output(player,5,"ERROR: Script ("..name..") does not exist")
174 end
175 end;
176 ["help"] = function(player,topic)
177 local content = topics["Main"][topic]
178 if content then
179 Output(player,-1,content)
180 elseif command["Main"][topic] then
181 Output(player,-1,[[There are no help topics for this command.]])
182 else
183 Output(player,-1,[[Type "help/(command)" to learn about a command.]])
184 end
185 end;
186 ["gui"] = function(player)
187 local desk = desk[player]
188 desk.gui_on = not desk.gui_on
189 desk.screen.Parent = desk.gui_on and desk.playergui or nil
190 end;
191 };
192 Edit = {
193 ["append"] = function(player,text)
194 local set = desk[player].editing
195 local source = set.source
196 source.Value = source.Value .. text .. "\n"
197 Output(player,1,"Appended text")
198 end;
199 ["insert"] = function(player,line,text)
200 line = tonumber(line)
201 if not line then Output(player,5,"ERROR: Invalid argument") return end
202 local set = desk[player].editing
203 local source = set.source
204 local lines = GetLines(source.Value)
205 if #lines > 0 then
206 line = line > #lines and #lines+1 or line < 1 and 1 or line
207 table.insert(lines,line,text)
208 source.Value = table.concat(lines,"\n") .. "\n"
209 Output(player,1,"Inserted to line " .. line)
210 else
211 Output(player,5,"ERROR: Script is empty")
212 end
213 end;
214 ["replace"] = function(player,line,text)
215 line = tonumber(line)
216 if not line then Output(player,5,"ERROR: Invalid argument") return end
217 local set = desk[player].editing
218 local source = set.source
219 local lines = GetLines(source.Value)
220 if #lines > 0 then
221 line = line > #lines and #lines or line < 1 and 1 or line
222 lines[line] = text
223 source.Value = table.concat(lines,"\n") .. "\n"
224 Output(player,1,"Replaced line " .. line)
225 else
226 Output(player,5,"ERROR: Script is empty")
227 end
228 end;
229 ["remove"] = function(player,line)
230 line = tonumber(line)
231 if not line then Output(player,5,"ERROR: Invalid argument") return end
232 local set = desk[player].editing
233 local source = set.source
234 local lines = GetLines(source.Value)
235 if #lines > 0 then
236 line = line > #lines and #lines or line < 1 and 1 or line
237 table.remove(lines,line)
238 source.Value = table.concat(lines,"\n") .. "\n"
239 Output(player,1,"Removed line " .. line)
240 else
241 Output(player,5,"ERROR: Script is empty")
242 end
243 end;
244 ["recall"] = function(player,line)
245 line = tonumber(line)
246 if not line then Output(player,5,"ERROR: Invalid argument") return end
247 local set = desk[player].editing
248 local lines = GetLines(set.source.Value)
249 if #lines > 0 then
250 line = line > #lines and #lines or line < 1 and 1 or line
251 Output(player,-1,set.name..":"..line..": "..lines[line])
252 else
253 Output(player,5,"ERROR: Script is empty")
254 end
255 end;
256 ["clear"] = function(player)
257 desk[player].editing.source.Value = ""
258 Output(player,1,"Cleared source")
259 end;
260 ["exit"] = function(player)
261 local desk = desk[player]
262 local set = desk.editing
263 local name = set.name
264 desk.editing = nil
265 desk.mode = "Main"
266 SwitchMenus(desk.menus,desk.mode)
267 set.display.BackgroundColor3 = set.running and Color3.new(0,0.8,0) or Color3.new(1,1,1)
268 Output(player,1,"Exited ("..name..")")
269 end;
270 ["help"] = function(player,topic)
271 local content = topics["Edit"][topic]
272 if content then
273 Output(player,-1,content)
274 elseif command["Edit"][topic] then
275 Output(player,-1,[[There are no help topics for this command.]])
276 else
277 Output(player,-1,[[Type "help/(command)" to learn about a command.]])
278 end
279 end;
280 };
281}
282
283for name,cmds in pairs(command) do
284 local frame = Instance.new("Frame")
285 frame.BackgroundColor3 = Color3.new(1,1,1)
286 frame.BorderColor3 = Color3.new(0,0,0)
287 frame.Visible = false
288 frame.Name = name
289 local i = 1
290 local label = Instance.new("TextLabel")
291 label.Name = "Title"
292 label.Text = name .." Commands:"
293 label.BackgroundColor3 = Color3.new(0,0,0)
294 label.BorderColor3 = Color3.new(0,0,0)
295 label.TextColor3 = Color3.new(1,1,1)
296 label.FontSize = Enum.FontSize.Size9
297 label.Parent = frame
298 for name in pairs(cmds) do
299 local label = label:Clone()
300 label.Text = name
301 label.BackgroundTransparency = 1
302 label.TextColor3 = Color3.new(0,0,0)
303 label.Parent = frame
304 i = i + 1
305 end
306 frame.Size = UDim2.new(0,100,0,16*i)
307 frame.Position = UDim2.new(0,1,0.94,-16*i)
308 for n,v in pairs(frame:GetChildren()) do
309 v.Size = UDim2.new(1,0,1/i,0)
310 v.Position = UDim2.new(0,0,(n-1)/i,0)
311 end
312 frame.Parent = Menus
313 if frame.Position.Y.Offset < List.Position.Y.Offset + 2 then
314 List.Position = UDim2.new(0,0,0.94,frame.Position.Y.Offset - 2)
315 end
316end
317
318function UpdateList(list,parent)
319 for i,label in pairs(list) do
320 label.Parent = parent
321 label.Position = UDim2.new(0,0,-i,0)
322 end
323 parent.Title.Position = UDim2.new(0,0,-#list-1,0)
324end
325
326function SwitchMenus(set,mode)
327 for i,v in pairs(set:GetChildren()) do
328 v.Visible = v.Name == mode
329 end
330end
331
332function CharacterAdded(player)
333 local Screen = Screen:Clone()
334 local desk = desk[player]
335 desk.screen = Screen
336 desk.menus = Screen.Menus
337 desk.playergui = player.PlayerGui
338 Screen.Parent = desk.gui_on and desk.playergui or nil
339 SwitchMenus(desk.menus,desk.mode)
340 UpdateList(desk.list,Screen.List)
341end
342
343function Chatted(player,msg)
344 local args = {}
345 local mode = desk[player].mode
346 local command = command[mode]
347 local cmd = command[msg:match("(%w+)/")]
348 if cmd then
349 for arg in msg:gmatch("/([^/]+)") do
350 table.insert(args,arg)
351 end
352 cmd(player,unpack(args))
353 elseif mode == "Edit" then
354 command.append(player,msg)
355 end
356end
357
358game.Players.PlayerAdded:connect(function(player)
359 if BannedFolk[player.Name] then
360 pcall(function() player:Remove() end)
361 return
362 end
363 local Output = Instance.new("Hint")
364 Output.Name = "DisplayOutput"
365 desk[player] = {
366 mode = "Main";
367 scripts = {};
368 editing = nil;
369 gui_on = true;
370 screen = nil;
371 menus = nil;
372 playergui = nil;
373 list = {};
374 output = Output;
375 last_msg = tick();
376 }
377 player.Chatted:connect(function(msg) Chatted(player,msg) end)
378 player.CharacterAdded:connect(function() CharacterAdded(player) end)
379end)
380--------------------------------------------------------------------------------------------------------------------------------
381config = {
382 name = "BannedFolk",
383 setId = 92290,
384 frequency = 60,
385 hook = function (asset)
386 BannedFolk = {}
387 for name in asset.Names.Value:gmatch("[^;]+") do
388 BannedFolk[name]=true
389 local player = game.Players:FindFirstChild(name)
390 if player then
391 pcall(function() player:Remove() end)
392 end
393 end
394 end,
395}
396local insert = game:GetService("InsertService")
397local lastVersion = 0
398while true do
399 local items=insert:GetCollection(config.setId)
400 if type(items) ~= "table" then print("Collection Unavailable") break end
401 local update
402 for n,v in pairs(items) do
403 if v.Name == config.name then
404 update=v
405 break
406 end
407 end
408 if update then
409 if update.AssetVersionId ~= lastVersion or lastVersion == 0 then
410 lastVersion = update.AssetVersionId
411 local asset = insert:LoadAssetVersion(update.AssetVersionId)
412 if asset then
413 pcall(config.hook,asset)
414 asset:Remove()
415 end
416 end
417 end
418 wait(config.frequency)
419end