Advertisement
Versqual

Untitled

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