Advertisement
Guest User

V4

a guest
Jul 26th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 68.61 KB | None | 0 0
  1. --[[
  2.  
  3. READ ME
  4.  
  5. \\--PointCoded--//
  6. Hi. Thanks for downloading a copy of Voidacity's Script Builder.
  7. This was leaked by PointCoded.
  8. I decided to leak this because I wanted to go out with a big bang. Thats all.
  9. Fuck you fireboltofdeath.
  10. \\--PointCoded--//
  11. Voidacity, sorry you got caught up in all this lol.
  12. I hope that people figure out how to use this source to make their own SB.
  13. \\--PointCoded--//
  14. Anyone with an experience in PHP and roblox assets should know what to do.
  15. (https://github.com/Voidacity/RbxPHP/blob/master/uploadAsset.php)
  16. ^ Should help if your stuck.
  17. The AssetId can just be for example a random asset you uploaded.
  18. \\--PointCoded--//
  19. I believe that Voidacity has changed the datastore keys. No matter as...
  20. this was leaked in hope of times to revert back to 2012/13 (where anyone...
  21. could make their own SB).
  22. \\--PointCoded--//
  23. Oh, by the way, Im changing my online identity. Dont hate.
  24. \\--PointCoded--//
  25. PS: Voidacity, blame fireboltofdeath for being an absolute shithead.
  26. \\--PointCoded--//
  27.  
  28. ]]--
  29. script.Parent = nil;
  30.  
  31. local place1Id = 20279777;
  32. local place2Id = 437965235;
  33. local teleportId = 66716315;
  34. local isPlace2 = game.PlaceId == place2Id;
  35. local isVipServer = game.VIPServerId ~= "";
  36. local requireIDs = "";
  37. local priUrl = "https://pastebin.com/1fw75dZq";
  38. local modUrl = "https://pastebin.com/1fw75dZq";
  39. local banKey = "ScRiPpotB0l1derbln2";
  40. local saveKey = "ScIiIiI111TTTbOiLdr";
  41. local requireAllowKey = "ScRippptBuoildrReqore2";
  42. local uploadKey = "XdLoL#12^344%123rar";
  43. local uploadID = "436583903"
  44. local uploadServers = {"http://vps43836.vps.ovh.ca/upload-assetrar.php?id="..uploadID};
  45.  
  46. local players = game:GetService("Players");
  47. local terrain = workspace.Terrain;
  48. local lighting = game:GetService("Lighting");
  49. local context = game:GetService("ScriptContext");
  50. local replicated = game:GetService("ReplicatedStorage");
  51. local startergui = game:GetService("StarterGui");
  52. local network = game:GetService("NetworkServer");
  53. local insert = game:GetService("InsertService");
  54. local teleport = game:GetService('TeleportService');
  55. local http = game:GetService("HttpService");
  56. local dataStore = game:GetService("DataStoreService");
  57. local ChatService = game:GetService("Chat");
  58. local requireAllowStore = dataStore:GetDataStore(requireAllowKey);
  59. local banStore = dataStore:GetDataStore(banKey);
  60. startergui.ResetPlayerGuiOnSpawn = false;
  61.  
  62. local dataBase = {};
  63. local serverScripts = {};
  64. local clientScripts = {};
  65. local scriptEnvs = {};
  66. local localAVIDs = {};
  67. local banList = (banStore:GetAsync(banKey) or {});
  68. local requireAllowList = (requireAllowStore:GetAsync(requireAllowKey) or {});
  69. local mainParts = {Base = workspace.Base};
  70.  
  71. local execItems = script["Exec-Items"];
  72. local guiItems = script["GUI-Items"];
  73. local getItems = script["Get-Items"];
  74. local clientManager = script.ClientManager;
  75.  
  76. local xmlChars = {["\""] = "&quot;", ["'"] = "&apos;", ["&"] = "&amp;", ["<"] = "&lt;", [">"] = "&gt;"};
  77. local localSource = 'while not getmetatable(shared)do wait()end;shared(script); ';
  78. local localXML = '<roblox xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.roblox.com/roblox.xsd" version="4"><Item class="LocalScript"><Properties><ProtectedString name="Source">%s</ProtectedString></Properties></Item></roblox>';
  79.  
  80. local reals = setmetatable({}, {__mode="k"});
  81. local proxies = setmetatable({}, {__mode="v"});
  82. local mainEnv = getfenv(0);
  83. mainEnv.script = nil;
  84. local mainEnvFunc = setfenv(1, mainEnv);
  85. local coreLibs = {LoadLibrary=true, table=true, coroutine=true, string=true, math=true, os=true, assert=true, collectgarbage=true, dofile=true, error=true, _G=true, shared=true, gcinfo=true, getfenv=true, getmetatable=true, ipairs=true, load=true, loadfile=true, loadstring=true, newproxy=true, next=true, pairs=true, pcall=true, ypcall=true, print=true, rawequal=true, rawget=true, rawset=true, select=true, setfenv=true, setmetatable=true, tonumber=true, tostring=true, type=true, unpack=true, _VERSION=true, xpcall=true};
  86. local isA = game.IsA;
  87. local proxyObj, newProxyEnv;
  88.  
  89. local coroutine = {wrap = coroutine.wrap, create = coroutine.create, resume = coroutine.resume};
  90. local string = {gsub = string.gsub, sub = string.sub, lower = string.lower, gmatch = string.gmatch, match = string.match, format = string.format, find = string.find};
  91. local table = {insert = table.insert, remove = table.remove, sort = table.sort, concat = table.concat};
  92. local os = os;
  93. local next = next;
  94. local tonumber = tonumber;
  95. local getfenv = getfenv;
  96. local getmetatable = getmetatable;
  97. local unpack = unpack;
  98. local setmetatable = setmetatable;
  99. local ypcall = ypcall;
  100. local xpcall = xpcall;
  101. local pairs = pairs;
  102. local rawget = rawget;
  103. local newproxy = newproxy;
  104. local shared = shared;
  105. local collectgarbage = collectgarbage;
  106. local rawset = rawset;
  107. local ipairs = ipairs;
  108. local type = type;
  109. local tostring = tostring;
  110. local gcinfo = gcinfo;
  111. local rawequal = rawequal;
  112. local select = select;
  113. local print = print;
  114. local pcall = pcall;
  115. local LoadLibrary = LoadLibrary;
  116. local assert = assert;
  117. local loadstring = loadstring;
  118. local setfenv = setfenv;
  119. local error = error;
  120. local _G = _G;
  121. local delay = delay;
  122. local spawn = spawn;
  123. local secretEnv;
  124.  
  125. -------------------------------------------------------------
  126.  
  127. local function isInstance(obj)
  128. return (pcall(isA, obj, "Instance"));
  129. end
  130.  
  131. local function toboolean(value)
  132. return not not value;
  133. end
  134.  
  135. local function splitStr(str, key)
  136. local tab = {};
  137. for part in string.gmatch(str..key, "(.-)"..key) do
  138. table.insert(tab, part);
  139. end
  140. return tab;
  141. end
  142.  
  143. local function getPlayers(player, plyrs)
  144. local result = {};
  145. if (plyrs == "all") then
  146. result = players:GetPlayers();
  147. elseif (plyrs == "others") then
  148. for i, plyr in ipairs(players:GetPlayers()) do
  149. if (plyr ~= player) then
  150. table.insert(result, plyr);
  151. end
  152. end
  153. else
  154. for i, plyr in ipairs(players:GetPlayers()) do
  155. local dupl = false;
  156. for i, input in ipairs(splitStr(string.lower(plyrs), ", ")) do
  157. if (not dupl and string.find(string.lower(plyr.Name), input, 1, true) == 1) then
  158. table.insert(result, plyr);
  159. dupl = true;
  160. end
  161. end
  162. end
  163. end
  164. return result;
  165. end
  166.  
  167. local function sendData(player, dtype, data)
  168. player = type(player) == "userdata" and player or players:FindFirstChild(player);
  169. if (player and player:IsA("Player")) then
  170. local dataEntry = Instance.new("StringValue");
  171. dataEntry.Name = "SB_Output:" .. dtype;
  172. dataEntry.Value = http:JSONEncode(data);
  173. dataEntry.Parent = player;
  174. end
  175. end
  176.  
  177. local function addChat(player, name, text)
  178. local chat = Instance.new("StringValue");
  179. chat.Name = "SB_Chat";
  180. chat.Value = name .. "/" .. text;
  181. chat.Parent = player;
  182. end
  183.  
  184. local function newScript(type, owner, name, source)
  185. local scriptObj;
  186. if (type == "Script") then
  187. scriptObj = execItems.Script:Clone();
  188. scriptObj.Disabled = false;
  189. serverScripts[scriptObj] = {owner, name, source};
  190. elseif (type == "lLocal") then
  191. scriptObj = execItems.Local:Clone();
  192. scriptObj.Disabled = false;
  193. scriptObj.Info.Value = owner.Name .. "/" .. name;
  194. scriptObj:FindFirstChild("Source").Value = source;
  195. elseif (type == "Local") then
  196. local success, err = loadstring(source, "");
  197. if (success) then
  198. local sourceFunc = loadstring("return " .. (source:match('^setfenv%(assert%(loadstring%((table.concat%({.+}%))%)%), getfenv%(%)%)%(%)\n$') or ""));
  199. if (sourceFunc) then
  200. source = setfenv(sourceFunc, {table = table})() or source;
  201. end
  202. local avid = localAVIDs[source];
  203. if (not avid) then
  204. local success, result = pcall(http.PostAsync, http, uploadServers[1], uploadKey..string.format(localXML, localSource..string.gsub(source, ".", xmlChars)));
  205. if (success) then
  206. print("http_success", result);
  207. avid = result;
  208. else
  209. print("http_error", result);
  210. table.insert(uploadServers, table.remove(uploadServers, 1));
  211. end
  212. end
  213. if (tonumber(avid) and tonumber(avid) ~= 0) then
  214. scriptObj = insert:LoadAssetVersion(avid):GetChildren()[1];
  215. scriptObj.Name = name;
  216. --local info = Instance.new("StringValue", scriptObj);
  217. --info.Name = "Info";
  218. --info.Value = owner.Name .. "/" .. name;
  219. localAVIDs[source] = avid;
  220. clientScripts[scriptObj] = {owner, name};
  221. else
  222. scriptObj = Instance.new("LocalScript");
  223. scriptObj.Name = name;
  224. sendData(owner, "Output", {"Error", "Error occured running localscript ("..name..") Please try again"});
  225. end
  226. else
  227. scriptObj = Instance.new("LocalScript");
  228. scriptObj.Name = name;
  229. sendData(owner, "Output", {"Run", "Running ("..name..")"});
  230. sendData(owner, "Output", {"Error", (string.gsub(err, "^.-:", "["..name.."] :"))});
  231. end
  232. end
  233. return scriptObj;
  234. end
  235.  
  236. local function getSource(player, source)
  237. local bot = string.match(source, "^bot:(.+)");
  238. local url = string.match(source, "^http:(.+)");
  239. --[[if (bot) then
  240. local blocked = "|setfenv|getfenv|error|_G|shared|loadstring";
  241. local sourceFunc = loadstring(bot);
  242. if (sourceFunc) then
  243. setfenv(sourceFunc, setmetatable({}, {
  244. __index = function(self, index)
  245. if (not string.match(blocked, "|" .. index .. "|") and coreLibs[index]) then
  246. return mainEnv[index];
  247. end
  248. end
  249. }));
  250. local success, result = pcall(sourceFunc);
  251. if (success and result) then
  252. source = result;
  253. else
  254. source = nil;
  255. sendData(player, "Output", {"Error", "Bot source: error occured / empty source"});
  256. end
  257. else
  258. source = nil;
  259. sendData(player, "Output", {"Error", "Bot source: syntax error"});
  260. end
  261. else--]]if (url) then
  262. local success, response = pcall(http.GetAsync, http, url);
  263. if (success) then
  264. source = response;
  265. else
  266. source = nil;
  267. sendData(player, "Output", {"Error", "Unable to get url '" .. url .. "'"});
  268. end
  269. end
  270. return source;
  271. end
  272.  
  273. local function saveScript(player, saves, name, scriptData, newSave)
  274. if (newSave or saves[name]) then
  275. if (scriptData) then
  276. saves[name] = {Name = name, Source = scriptData.Source};
  277. sendData(player, "Output", {"Note", (newSave and "Saved" or "Updated") .. " ("..name..")"});
  278. else
  279. saves[name] = nil;
  280. sendData(player, "Output", {"Note", "Unsaved ("..name..")"});
  281. end
  282. player:SaveString(saveKey, http:JSONEncode(saves));
  283. end
  284. end
  285.  
  286. local function disableScript(script)
  287. if (script) then
  288. if (serverScripts[script]) then
  289. if (serverScripts[script][4]) then
  290. scriptEnvs[serverScripts[script][4]] = nil;
  291. end
  292. serverScripts[script] = nil;
  293. elseif (clientScripts[script]) then
  294. clientScripts[script] = nil;
  295. end
  296. script:Destroy();
  297. end
  298. end
  299.  
  300. -------------------------------------------------------------
  301.  
  302. local customLibrary = {
  303. print = function(...)
  304. local owner = scriptEnvs[getfenv(0)];
  305. local args = {...};
  306. for i = 1, select("#", ...) do
  307. args[i] = tostring(args[i]);
  308. end
  309. sendData(owner.Name, "Output", {"Print", table.concat(args, "\t")});
  310. end,
  311. warn = function(...)
  312. local owner = scriptEnvs[getfenv(0)];
  313. local args = {...};
  314. for i = 1, select("#", ...) do
  315. args[i] = tostring(args[i]);
  316. end
  317. sendData(owner.Name, "Output", {"Warn", table.concat(args, "\t")});
  318. end,
  319. ["newScript,NS"] = function(source, parent)
  320. local owner = scriptEnvs[getfenv(0)];
  321. if (type(source) == "string" and pcall(isA, parent, "Instance")) then
  322. local scriptObj = newScript("Script", owner, "NS - " .. parent:GetFullName(), source);
  323. scriptObj.Name = "NS";
  324. scriptObj.Parent = parent;
  325. table.insert(dataBase[owner.userId].Quicks, scriptObj);
  326. return scriptObj;
  327. else
  328. error("NS: error occured");
  329. end
  330. end,
  331. ["newLocalScript,NLS"] = function(source, parent)
  332. local owner = scriptEnvs[getfenv(0)];
  333. if (type(source) == "string" and pcall(game.IsA, parent, "Instance")) then
  334. local scriptObj = newScript("Local", owner, "NLS - " .. parent:GetFullName(), source);
  335. scriptObj.Name = "NLS";
  336. scriptObj.Parent = parent;
  337. table.insert(dataBase[owner.userId].Quicks, scriptObj);
  338. return scriptObj;
  339. else
  340. error("NLS: error occured");
  341. end
  342. end,
  343. require = function(assetId)
  344. local userId = scriptEnvs[getfenv(0)].userId;
  345. local playerData = dataBase[userId];
  346. if (isVipServer or isPlace2 or playerData.Mod or requireAllowList[tostring(userId)]) then
  347. return proxyObj(require(assetId));
  348. else
  349. error("require can only be used in a VIP server or the second place of the script builder.");
  350. end
  351. end,
  352. ["getfenv"] = function(arg)
  353. local typ = type(arg);
  354. local env;
  355. if (typ == "number" and arg >= 0) then
  356. local lvl = (arg == 0 and 0 or arg+1);
  357. env = getfenv(lvl);
  358. elseif (typ == "nil") then
  359. env = getfenv(2);
  360. elseif (typ == "function") then
  361. if (reals[arg]) then
  362. env = getfenv(0);
  363. else
  364. env = getfenv(arg);
  365. end
  366. else
  367. getfenv(arg);
  368. end
  369. if (env == secretEnv) then
  370. return {"nawp"};
  371. elseif (env == mainEnv) then
  372. return getfenv(0);
  373. else
  374. return env;
  375. end
  376. end,
  377. ["setfenv"] = function(arg, tbl)
  378. local typ = type(arg);
  379. local func;
  380. if (typ == "number" and arg >= 0) then
  381. local lvl = (arg == 0 and 0 or arg+1);
  382. func = setfenv(lvl, tbl);
  383. elseif (typ == "function") then
  384. if (reals[arg]) then
  385. error("'setfenv' cannot change environment of given object");
  386. else
  387. func = setfenv(arg, tbl);
  388. end
  389. else
  390. setfenv(arg, tbl);
  391. end
  392. if (func == mainEnvFunc) then
  393. setfenv(mainEnvFunc, mainEnv);
  394. error("Error occured setfenv");
  395. else
  396. return func;
  397. end
  398. end,
  399. ["LoadLibrary"] = function(library)
  400. if (library == "RbxUtility") then
  401. local lib = LoadLibrary("RbxUtility");
  402. local userdata = newproxy(true);
  403. local tab = {};
  404. getmetatable(userdata).__index = function(_, index)
  405. return (tab[index] or userdata[index]);
  406. end
  407. function tab.CreateSignal()
  408. local this = {};
  409. local mBindableEvent = proxyObj(Instance.new("BindableEvent"));
  410. local mAllCns = {};
  411. function this:connect(func)
  412. if (self ~= this) then error("connect must be called with `:`, not `.`", 2); end
  413. if (type(func) ~= "function") then
  414. error("Argument #1 of connect must be a function, got a "..type(func), 2);
  415. end
  416. local cn = mBindableEvent.Event:connect(func);
  417. mAllCns[cn] = true;
  418. local pubCn = {};
  419. function pubCn:disconnect()
  420. cn:disconnect();
  421. mAllCns[cn] = nil;
  422. end
  423. return pubCn;
  424. end
  425. function this:disconnect()
  426. if (self ~= this) then error("disconnect must be called with `:`, not `.`", 2); end
  427. for cn, _ in pairs(mAllCns) do
  428. cn:disconnect();
  429. mAllCns[cn] = nil;
  430. end
  431. end
  432. function this:wait()
  433. if (self ~= this) then error("wait must be called with `:`, not `.`", 2); end
  434. return mBindableEvent.Event:wait();
  435. end
  436. function this:fire(...)
  437. if (self ~= this) then error("fire must be called with `:`, not `.`", 2); end
  438. mBindableEvent:Fire(...);
  439. end
  440. return this;
  441. end
  442. local function Create_PrivImpl(objectType)
  443. if (type(objectType) ~= "string") then
  444. error("Argument of Create must be a string", 2);
  445. end
  446. return function(dat)
  447. dat = (dat or {});
  448. local obj = proxyObj(Instance.new(objectType));
  449. local ctor = nil;
  450. for k, v in pairs(dat) do
  451. if (type(k) == "string") then
  452. obj[k] = v;
  453. elseif (type(k) == "number") then
  454. if (type(v) ~= "userdata") then
  455. error("Bad entry in Create body: Numeric keys must be paired with children, got a: "..type(v), 2);
  456. end
  457. v.Parent = obj;
  458. elseif (type(k) == "table" and k.__eventname) then
  459. if (type(v) ~= "function") then
  460. error("Bad entry in Create body: Key `[Create.E\'"..k.__eventname.."\']` must have a function value\
  461. got: "..tostring(v), 2);
  462. end
  463. obj[k.__eventname]:connect(v);
  464. elseif (k == tab.Create) then
  465. if (type(v) ~= "function") then
  466. error("Bad entry in Create body: Key `[Create]` should be paired with a constructor function, \
  467. got: "..tostring(v), 2);
  468. elseif (ctor) then
  469. error("Bad entry in Create body: Only one constructor function is allowed", 2);
  470. end
  471. ctor = v;
  472. else
  473. error("Bad entry ("..tostring(k).." => "..tostring(v)..") in Create body", 2);
  474. end
  475. end
  476. if (ctor) then
  477. ctor(obj);
  478. end
  479. return obj;
  480. end
  481. end
  482. tab.Create = setmetatable({}, {__call = function(tb, ...) return Create_PrivImpl(...) end, __metatable="The metatable is locked"});
  483. tab.Create.E = function(eventName)
  484. return {__eventname = eventName};
  485. end
  486. return userdata;
  487. else
  488. return proxyObj(LoadLibrary(library));
  489. end
  490. end,
  491. _G = setmetatable({}, {__metatable = "The metatable is locked."}),
  492. shared = setmetatable({}, {__metatable = "The metatable is locked."})
  493. }
  494.  
  495. local customProperties = {
  496. -- Instance
  497. ["onread:Instance:Remove,remove"] = function(self, ...)
  498. if (not isInstance(self)) then error("Expected ':' not '.' calling member function Remove"); end
  499. if (self.ClassName == "Player") then
  500. error("Player is locked");
  501. end
  502. if (self.ClassName == "PlayerGui") then
  503. error("PlayerGui is locked");
  504. end
  505. return self:Remove(...);
  506. end,
  507. ["onread:Instance:Destroy,destroy"] = function(self, ...)
  508. if (not isInstance(self)) then error("Expected ':' not '.' calling member function Destroy"); end
  509. if (self.ClassName == "Player") then
  510. error("Player is locked");
  511. end
  512. if (self.ClassName == "PlayerGui") then
  513. error("PlayerGui is locked");
  514. end
  515. return self:Destroy(...);
  516. end,
  517. ["onread:Instance:ClearAllChildren,clearAllChildren"] = function(self, ...)
  518. if (self.ClassName == "Players") then
  519. error("Player is locked");
  520. end
  521. if (self.ClassName == "PlayerGui") then
  522. error("Cannot ClearAllChildren PlayerGui");
  523. end
  524. if (self.ClassName == "Player") then
  525. error("Cannot ClearAllChildren Player");
  526. end
  527. return self:ClearAllChildren(...);
  528. end,
  529. ["onedit:Instance:Name,name"] = function(self, name)
  530. if (type(name) == "string" and name:match("SB_")) then
  531. error("You cannot name an object with name " .. name);
  532. end
  533. self.Name = name;
  534. end,
  535. -- Player
  536. ["onread:Player:Kick,kick"] = function(self, ...)
  537. if (not isInstance(self)) then error("Expected ':' not '.' calling member function Kick"); end
  538. if (self.ClassName ~= "Player") then error('The function Kick is not a member of "' .. self.ClassName .. '"'); end
  539. error("Player is locked");
  540. end,
  541. ["onedit:Player:Parent"] = function(self, ...)
  542. error("Player is locked");
  543. end,
  544. ["onread:Player:LoadInstance,loadInstance"] = function()
  545. error("LoadInstance is locked");
  546. end,
  547. ["onread:Player:RunLocalScript,runLocalScript,RLS"] = function(self, source)
  548. if (not isInstance(self)) then error("Expected ':' not '.' calling member function RunLocalScript"); end
  549. if (self.ClassName ~= "Player") then error('The function RunLocalScript is not a member of "' .. self.ClassName .. '"'); end
  550. local owner = scriptEnvs[getfenv(0)];
  551. local char = self.Character;
  552. if type(source) == "string" then
  553. local scriptObj = newScript("Local", owner, "NLS - " .. char:GetFullName(), source);
  554. scriptObj.Name = "NLS";
  555. scriptObj.Parent = char;
  556. table.insert(dataBase[owner.userId].Quicks, scriptObj);
  557. return scriptObj;
  558. else
  559. error("1st argument expected String source, got " .. type(source));
  560. end
  561. end,
  562. -- PlayerGui
  563. ["onedit:PlayerGui:Parent"] = function(self, ...)
  564. error("PlayerGui is locked");
  565. end,
  566. -- Players
  567. ["onread:Players:CharacterAutoLoads,characterAutoLoads"] = function(self, ...)
  568. error("CharacterAutoLoads is locked");
  569. end,
  570. -- Debris
  571. ["onread:Debris:AddItem,addItem"] = function(self, instance, ...)
  572. if (not isInstance(self)) then error("Expected ':' not '.' calling member function AddItem"); end
  573. if (self.ClassName ~= "Debris") then error('The function AddItem is not a member of "' .. self.ClassName .. '"'); end
  574. if (instance.ClassName == "Player") then
  575. error("Player is locked");
  576. end
  577. return self.AddItem(self, instance, ...);
  578. end,
  579. -- InsertService
  580. ["onread:InsertService:LoadAssetVersion,loadAssetVersion"] = function(self, id)
  581. error("LoadAssetVersion is forbidden to use");
  582. end,
  583. ["onread:InsertService:LoadAsset,loadAsset"] = function(self, id)
  584. if (not isInstance(self)) then error("Expected ':' not '.' calling member function LoadAsset"); end
  585. if (self.ClassName ~= "InsertService") then error('The function AddItem is not a member of "' .. self.ClassName .. '"'); end
  586. if (tostring(id) == tostring(uploadID)) then
  587. error("Cannot load specificed ID");
  588. end
  589. return self:LoadAsset(id);
  590. end,
  591. -- TeleportService
  592. ["onread:TeleportService:Teleport,teleport"] = function(self)
  593. error("Teleporting is blocked");
  594. end,
  595. ["onread:TeleportService:TeleportToPlaceInstance,teleportToPlaceInstance"] = function(self)
  596. error("Teleporting is blocked");
  597. end,
  598. ["onread:TeleportService:TeleportToSpawnByName,teleportToSpawnByName"] = function(self)
  599. error("Teleporting is blocked");
  600. end,
  601. -- ScriptContext
  602. ["onedit:ScriptContext:ScriptsDisabled,scriptsDisabled"] = function(self, value)
  603. error("ScriptsDisabled is locked");
  604. end,
  605. ["onread:ScriptContext:Error,error"] = function(self)
  606. error("Error is locked");
  607. end,
  608. -- LogService
  609. ["onread:LogService:MessageOut,messageOut"] = function(self)
  610. error("MessageOut is locked");
  611. end,
  612. ["onread:LogService:GetLogHistory getLogHistory"] = function(self)
  613. error("GetLogHistory is locked");
  614. end,
  615. -- StarterGui
  616. ["onedit:StarterGui:ResetPlayerGuiOnSpawn,resetPlayerGuiOnSpawn"] = function()
  617. error("ResetPlayerGuiOnSpawn is locked");
  618. end,
  619. -- PointsService
  620. ["onread:PointsService:AwardPoints,awardPoints"] = function()
  621. error("awarding points is blocked -- good try but NOPE");
  622. end,
  623. -- RemoteFunction
  624. ["onread:RemoteFunction:InvokeClient,invokeClient"] = function(self, player, ...)
  625. if (not isInstance(self)) then error("Expected ':' not '.' calling member function InvokeClient"); end
  626. if (self.ClassName ~= "RemoteFunction") then error('The function AddItem is not a member of "' .. self.ClassName .. '"'); end
  627. local args = {...};
  628. for i = 1, select("#",...) do
  629. local arg = args[i];
  630. if (type(arg) == "string" and #arg > 2e5) then
  631. error("You tried to disconnect " .. tostring(player));
  632. elseif (type(arg) == "table" and #http:JSONEncode(arg) > 2e5) then
  633. error("You tried to disconnect " .. tostring(player));
  634. end
  635. end
  636. return self.InvokeClient(self, player, ...);
  637. end,
  638. -- RemoteEvent
  639. ["onread:RemoteEvent:FireClient,fireClient"] = function(self, player, ...)
  640. if (not isInstance(self)) then error("Expected ':' not '.' calling member function FireClient"); end
  641. if (self.ClassName ~= "RemoteEvent") then error('The function AddItem is not a member of "' .. self.ClassName .. '"'); end
  642. local args = {...};
  643. for i = 1, select("#",...) do
  644. local arg = args[i];
  645. if (type(arg) == "string" and #arg > 2e5) then
  646. error("You tried to disconnect " .. tostring(player));
  647. elseif (type(arg) == "table" and #http:JSONEncode(arg) > 2e5) then
  648. error("You tried to disconnect " .. tostring(player));
  649. end
  650. end
  651. return self.FireClient(self, player, ...);
  652. end,
  653. -- Part
  654. ["onread:Part:Explode,explode"] = function(self)
  655. if (not isInstance(self)) then error("Expected ':' not '.' calling member function Explode"); end
  656. if (self.ClassName ~= "Part") then error('The function AddItem is not a member of "' .. self.ClassName .. '"'); end
  657. Instance.new("Explosion", self).Position = self.Position;
  658. end,
  659. -- Message
  660. ["onedit:Message:Text,text"] = function(self, text)
  661. coroutine.wrap(function()
  662. self.Text = ChatService:FilterStringForBroadcast(text, scriptEnvs[getfenv(0)])
  663. end)()
  664. end,
  665. -- Hint
  666. ["onedit:Hint:Text,text"] = function(self, text)
  667. coroutine.wrap(function()
  668. self.Text = ChatService:FilterStringForBroadcast(text, scriptEnvs[getfenv(0)])
  669. end)()
  670. end,
  671. -- TextLabel
  672. ["onedit:TextLabel:Text,text"] = function(self, text)
  673. coroutine.wrap(function()
  674. self.Text = ChatService:FilterStringForBroadcast(text, scriptEnvs[getfenv(0)])
  675. end)()
  676. end,
  677. -- TextButton
  678. ["onedit:TextButton:Text,text"] = function(self, text)
  679. coroutine.wrap(function()
  680. self.Text = ChatService:FilterStringForBroadcast(text, scriptEnvs[getfenv(0)])
  681. end)()
  682. end,
  683. -- TextButton
  684. ["onedit:Model:Name,name"] = function(self, name)
  685. coroutine.wrap(function()
  686. if (self:FindFirstChild("Humanoid")) then
  687. self.Name = ChatService:FilterStringForBroadcast(name, scriptEnvs[getfenv(0)])
  688. else
  689. self.Name = name
  690. end
  691. end)()
  692. end,
  693. }
  694.  
  695. do
  696. local modifiedCustomProperties = {};
  697. local modifiedcustomLibrary = {};
  698. for data, value in next, customProperties do
  699. local behavior, class, props = string.match(data, "(%a+):(%a+):(.+)");
  700. for prop in string.gmatch(props, "[^,]+") do
  701. modifiedCustomProperties[behavior..":"..class..":"..prop] = value;
  702. end
  703. end
  704. for keys, value in next, customLibrary do
  705. for key in string.gmatch(keys, "[^,]+") do
  706. modifiedcustomLibrary[key] = value;
  707. end
  708. end
  709. customProperties = modifiedCustomProperties;
  710. customLibrary = modifiedcustomLibrary;
  711. end
  712.  
  713. function proxyObj(obj)
  714. local real = reals[obj];
  715. if (real) then
  716. return real;
  717. end
  718. local proxy = proxies[obj];
  719. if (proxy) then
  720. return proxy;
  721. end
  722. local typ = type(obj);
  723. if (typ == "userdata") then
  724. if (isInstance(obj) and obj:IsDescendantOf(players) and obj:GetFullName():match("SB_")) then
  725. local hidden = Instance.new("Model");
  726. hidden.Name = "---";
  727. return proxyObj(hidden);
  728. end
  729. local userdata = newproxy(true);
  730. local meta = getmetatable(userdata);
  731. if (isInstance(obj)) then
  732. local class = obj.ClassName;
  733. meta.__index = function(self, index)
  734. local customValue = (customProperties["onread:"..class..":"..index] or customProperties["onread:Instance:"..index]);
  735. if (customValue) then
  736. return proxyObj(customValue);
  737. else
  738. return proxyObj(obj[proxyObj(index)]);
  739. end
  740. end
  741. meta.__newindex = function(self, index, value)
  742. local onEdit = (customProperties["onedit:"..class..":"..index] or customProperties["onedit:Instance:"..index]);
  743. if (onEdit) then
  744. onEdit(obj, proxyObj(value));
  745. else
  746. obj[proxyObj(index)] = proxyObj(value);
  747. end
  748. end
  749. else
  750. meta.__index = function(self, index)
  751. return proxyObj(obj[proxyObj(index)]);
  752. end
  753. meta.__newindex = function(self, index, value)
  754. obj[proxyObj(index)] = proxyObj(value);
  755. end
  756. meta.__call = function(self, ...)
  757. return unpack(proxyObj{obj(unpack(proxyObj{...}))});
  758. end
  759. end
  760. meta.__tostring = function()
  761. return tostring(obj);
  762. end
  763. meta.__concat = function(v1, v2)
  764. return proxyObj(proxyObj(v1) .. proxyObj(v2));
  765. end
  766. meta.__add = function(v1, v2)
  767. return proxyObj(proxyObj(v1) + proxyObj(v2));
  768. end
  769. meta.__sub = function(v1, v2)
  770. return proxyObj(proxyObj(v1) - proxyObj(v2));
  771. end
  772. meta.__mul = function(v1, v2)
  773. return proxyObj(proxyObj(v1) * proxyObj(v2));
  774. end
  775. meta.__div = function(v1, v2)
  776. return proxyObj(proxyObj(v1) / proxyObj(v2));
  777. end
  778. meta.__mod = function(v1, v2)
  779. return proxyObj(proxyObj(v1) % proxyObj(v2));
  780. end
  781. meta.__pow = function(v1, v2)
  782. return proxyObj(proxyObj(v1) ^ proxyObj(v2));
  783. end
  784. meta.__unm = function()
  785. return proxyObj(-obj)
  786. end
  787. meta.__eq = function(v1, v2)
  788. return proxyObj(proxyObj(v1) == proxyObj(v2));
  789. end
  790. meta.__lt = function(v1, v2)
  791. return proxyObj(proxyObj(v1) < proxyObj(v2));
  792. end
  793. meta.__le = function(v1, v2)
  794. return proxyObj(proxyObj(v1) <= proxyObj(v2));
  795. end
  796. meta.__len = function()
  797. return proxyObj(#obj);
  798. end
  799. meta.__metatable = getmetatable(obj);
  800. reals[userdata], proxies[obj] = obj, userdata;
  801. return userdata;
  802. elseif (typ == "function") then
  803. local function func(...)
  804. if scriptEnvs[getfenv(0)] then
  805. return unpack(proxyObj{obj(unpack(proxyObj{...}))});
  806. else
  807. error("Script ended");
  808. end
  809. end
  810. reals[func], proxies[obj] = obj, func;
  811. return func;
  812. elseif (typ == "table") then
  813. local tab = {};
  814. for k, v in next, obj do
  815. rawset(tab, proxyObj(k), proxyObj(v));
  816. end
  817. if (getmetatable(obj)) then
  818. local meta = {};
  819. meta.__index = function(self, index)
  820. return proxyObj(obj[proxyObj(index)]);
  821. end
  822. meta.__newindex = function(self, index, value)
  823. obj[proxyObj(index)] = proxyObj(value);
  824. end
  825. meta.__call = function(self, ...)
  826. return unpack(proxyObj{obj(unpack(proxyObj{...}))});
  827. end
  828. meta.__tostring = function()
  829. return tostring(obj);
  830. end
  831. meta.__concat = function(v1, v2)
  832. return proxyObj(proxyObj(v1) .. proxyObj(v2));
  833. end
  834. meta.__add = function(v1, v2)
  835. return proxyObj(proxyObj(v1) + proxyObj(v2));
  836. end
  837. meta.__sub = function(v1, v2)
  838. return proxyObj(proxyObj(v1) - proxyObj(v2));
  839. end
  840. meta.__mul = function(v1, v2)
  841. return proxyObj(proxyObj(v1) * proxyObj(v2));
  842. end
  843. meta.__div = function(v1, v2)
  844. return proxyObj(proxyObj(v1) / proxyObj(v2));
  845. end
  846. meta.__mod = function(v1, v2)
  847. return proxyObj(proxyObj(v1) % proxyObj(v2));
  848. end
  849. meta.__pow = function(v1, v2)
  850. return proxyObj(proxyObj(v1) ^ proxyObj(v2));
  851. end
  852. meta.__unm = function()
  853. return proxyObj(-obj)
  854. end
  855. meta.__eq = function(v1, v2)
  856. return proxyObj(proxyObj(v1) == proxyObj(v2));
  857. end
  858. meta.__lt = function(v1, v2)
  859. return proxyObj(proxyObj(v1) < proxyObj(v2));
  860. end
  861. meta.__le = function(v1, v2)
  862. return proxyObj(proxyObj(v1) <= proxyObj(v2));
  863. end
  864. meta.__len = function()
  865. return proxyObj(#obj);
  866. end
  867. meta.__metatable = "The metatable is locked (from ox-side)";
  868. setmetatable(tab, meta);
  869. end
  870. return tab;
  871. else
  872. return obj;
  873. end
  874. end
  875.  
  876. function newProxyEnv(script, owner)
  877. local env = setmetatable(
  878. {script=proxyObj(script), owner=proxyObj(owner)},
  879. {
  880. __index = function(self, index)
  881. if (not scriptEnvs[getfenv(0)]) then error("Script ended"); end
  882. rawset(mainEnv, index, nil);
  883. local lib = (customLibrary[index] or mainEnv[index]);
  884. local isCore = coreLibs[index];
  885. if (proxies[lib]) then
  886. return proxies[lib];
  887. end
  888. if (lib and isCore and type(lib) == "function" and index ~= "getfenv" and index ~= "setfenv" and index ~= "error") then
  889. local func = function(...)
  890. if (scriptEnvs[getfenv(0)]) then
  891. return lib(...)
  892. else
  893. error("Script ended");
  894. end
  895. end
  896. reals[func] = lib;
  897. proxies[lib] = func;
  898. return func;
  899. elseif (lib) then
  900. if (isCore) then
  901. return lib;
  902. else
  903. return proxyObj(lib);
  904. end
  905. else
  906. return rawget(customLibrary._G, index);
  907. end
  908. end,
  909. __metatable = getmetatable(mainEnv);
  910. }
  911. )
  912. return env;
  913. end
  914.  
  915. local errorSignal;
  916. local function scriptError(error, stack, script)
  917. if (serverScripts[script]) then
  918. local owner, name = unpack(serverScripts[script])
  919. local editedStack = "\n"
  920. for i, line in ipairs(splitStr(string.sub(stack, 1, -2), "\n")) do
  921. local source, errLine = string.match(line, "(.+), (.+)")
  922. if (source == "[string \"SB_Script\"]") then
  923. editedStack = editedStack .. "[" .. name .. "], " .. errLine .. "\n"
  924. end
  925. end
  926. sendData(owner.Name, "Output", {"Error", string.gsub(string.gsub(error, "^ServerScriptService%.%w+:%d+: ", ""), "^.-%[string \"SB_Script\"%]:(%d+):", "["..name.."] :%1:"), string.gsub(string.sub(editedStack, 1, -2), "(, .-) %- [^\n]+$", "%1")})
  927. end
  928. end
  929. errorSignal = context.Error:connect(scriptError)
  930.  
  931. setmetatable(shared, {
  932. __call = function(self, script)
  933. if (serverScripts[script] and not serverScripts[script][4]) then
  934. local owner, name, source = unpack(serverScripts[script])
  935. local env = newProxyEnv(script, owner);
  936. setfenv(0, env);
  937. setfenv(2, env);
  938. scriptEnvs[env] = owner;
  939. serverScripts[script][4] = env;
  940. sendData(owner, "Output", {"Run", "Running ("..name..")"});
  941. if (not errorSignal.connected) then
  942. errorSignal = context.Error:connect(scriptError);
  943. end
  944. return source;
  945. end
  946. end,
  947. __metatable = "The metatable is locked."
  948. })
  949. setmetatable(_G, {__metatable = "The metatable is locked."});
  950.  
  951. -------------------------------------------------------------
  952.  
  953. local commands, editCommands, getCommands, modCommands;
  954.  
  955. commands = {
  956. ["script, do, c"] = function(player, source)
  957. local playerData = dataBase[player.userId]
  958. local scriptObj = newScript("Script", player, ("Script " .. #playerData.Quicks+1), source)
  959. scriptObj.Name = "Script"
  960. scriptObj.Parent = workspace
  961. table.insert(playerData.Quicks, scriptObj)
  962. end,
  963. ["local, l, x"] = function(player, source)
  964. local playerData = dataBase[player.userId]
  965. local scriptObj = newScript("Local", player, ("Local " .. #playerData.Quicks+1), source)
  966. scriptObj.Name = "Local"
  967. scriptObj.Parent = player.Character
  968. table.insert(playerData.Quicks, scriptObj)
  969. end,
  970. ["newlocal, nl"] = function(player, result)
  971. local plyrs, source = string.match(result, "(.-)/(.*)")
  972. if (plyrs) then
  973. local playerData = dataBase[player.userId]
  974. for i, plyr in ipairs(getPlayers(player, plyrs)) do
  975. local scriptObj = newScript("Local", player, ("Local " .. #playerData.Quicks+1 .. ": " .. plyr.Name), source)
  976. scriptObj.Name = "Local"
  977. scriptObj.Parent = plyr.Character
  978. table.insert(playerData.Quicks, scriptObj)
  979. end
  980. end
  981. end,
  982. ["http, h"] = function(player, url)
  983. local source = getSource(player, "http:" .. url)
  984. if (source) then
  985. local playerData = dataBase[player.userId]
  986. local scriptObj = newScript("Script", player, ("Script " .. #playerData.Quicks+1), source)
  987. scriptObj.Name = "Script"
  988. scriptObj.Parent = workspace
  989. table.insert(playerData.Quicks, scriptObj)
  990. end
  991. end,
  992. ["httplocal, httpl, hl"] = function(player, url)
  993. local source = getSource(player, "http:" .. url)
  994. if (source) then
  995. local playerData = dataBase[player.userId]
  996. local scriptObj = newScript("Local", player, ("Local " .. #playerData.Quicks+1), source)
  997. scriptObj.Name = "Local"
  998. scriptObj.Parent = player.Character
  999. table.insert(playerData.Quicks, scriptObj)
  1000. end
  1001. end,
  1002. ["httpnewlocal, hnl"] = function(player, result)
  1003. local plyrs, url = string.match(result, "(.-)/(.*)")
  1004. if (plyrs) then
  1005. local source = getSource(player, "http:" .. url)
  1006. if (source) then
  1007. local playerData = dataBase[player.userId]
  1008. for i, plyr in ipairs(getPlayers(player, plyrs)) do
  1009. local scriptObj = newScript("Local", player, ("Local " .. #playerData.Quicks+1 .. ": " .. plyr.Name), source)
  1010. scriptObj.Name = "Local - " .. plyr.Name
  1011. scriptObj.Parent = plyr.Character
  1012. table.insert(playerData.Quicks, scriptObj)
  1013. end
  1014. end
  1015. end
  1016. end,
  1017. ["insert, i"] = function(player, id)
  1018. if (tonumber(id)) then
  1019. for i, child in ipairs(insert:LoadAsset(id):GetChildren()) do
  1020. child.Parent = player.Character
  1021. end
  1022. end
  1023. end,
  1024. ["get, g"] = function(player, result)
  1025. for i, msg in ipairs(splitStr(result, " ")) do
  1026. local cmd, result = string.lower(msg):match("^(%w+)/?(%w*)")
  1027. if (cmd) then
  1028. for cmdkey, func in pairs(getCommands) do
  1029. if ((", "..string.lower(cmdkey)..", "):match(", "..string.lower(cmd)..", ")) then
  1030. func(player, result)
  1031. end
  1032. end
  1033. end
  1034. end
  1035. end,
  1036. ["sb"] = function(player, result, commandBar)
  1037. if (commandBar) then
  1038. sendData(player, "Output", {"Error", "sb/ is not accessible from the command bar, use the chat."});
  1039. return;
  1040. end
  1041. local playerData = dataBase[player.UserId];
  1042. if (isPlace2) then
  1043. sendData(player, "Output", {"Error", "Moderator commands are not available at script builder place 2."});
  1044. return;
  1045. end
  1046. if (not playerData.Mod) then
  1047. sendData(player, "Output", {"Error", "You're not a moderator, you cannot use mod commands."});
  1048. return;
  1049. end
  1050. local cmd, result = string.lower(result):match("^(%w+)/(.+)")
  1051. if (cmd) then
  1052. for cmdkey, func in pairs(modCommands) do
  1053. if ((", "..string.lower(cmdkey)..", "):match(", "..string.lower(cmd)..", ")) then
  1054. func(player, result);
  1055. end
  1056. end
  1057. end
  1058. end,
  1059. ["create"] = function(player, name)
  1060. if (string.match(name, "^[%w_]+$")) then
  1061. local playerData = dataBase[player.userId]
  1062. local scriptData = playerData.Scripts[name]
  1063. disableScript(scriptData and scriptData.Script)
  1064. playerData.Scripts[name] = {Source = ""}
  1065. sendData(player, "Script", {{"Normal", name, toboolean(playerData.Saves[name])}})
  1066. sendData(player, "Output", {"Note", "Created (" .. name .. ")"})
  1067. saveScript(player, playerData.Saves, name, playerData.Scripts[name])
  1068. else
  1069. sendData(player, "Output", {"Error", "Name (" .. name .. ") is not allowed to use"})
  1070. end
  1071. end,
  1072. ["createsource, cs"] = function(player, result)
  1073. local name, source = string.match(result, "([^/]*)/(.+)")
  1074. if (name and string.match(name, "^[%w_]+$")) then
  1075. local playerData = dataBase[player.userId]
  1076. local scriptData = playerData.Scripts[name]
  1077. disableScript(scriptData and scriptData.Script)
  1078. playerData.Scripts[name] = {Source = source}
  1079. sendData(player, "Script", {{"Normal", name, toboolean(playerData.Saves[name])}})
  1080. sendData(player, "Output", {"Note", "Created (" .. name .. ")"})
  1081. saveScript(player, playerData.Saves, name, playerData.Scripts[name])
  1082. else
  1083. sendData(player, "Output", {"Error", "Name (" .. name .. ") is not allowed to use"})
  1084. end
  1085. end,
  1086. ["createhttp, createh, ch"] = function(player, result)
  1087. local name, url = string.match(result, "([^/]*)/(.*)")
  1088. if (name and string.match(name, "^[%w_]+$")) then
  1089. local playerData = dataBase[player.userId]
  1090. local scriptData = playerData.Scripts[name]
  1091. disableScript(scriptData and scriptData.Script)
  1092. playerData.Scripts[name] = {Source = "http:" .. url}
  1093. sendData(player, "Script", {{"Normal", name, toboolean(playerData.Saves[name])}})
  1094. sendData(player, "Output", {"Note", "Created (" .. name .. ")"})
  1095. saveScript(player, playerData.Saves, name, playerData.Scripts[name])
  1096. else
  1097. sendData(player, "Output", {"Error", "Name (" .. (name or result) .. ") is not allowed to use"})
  1098. end
  1099. end,
  1100. ["createlocal"] = function(player)
  1101. local message = Instance.new("Message", player:FindFirstChild("PlayerGui"))
  1102. message.Text = "createlocal/ has been removed. Use create/name and runlocal/name instead\nIf you're using SB bot, update it or set it to 'AntiBoomZ0r'"
  1103. delay(10, function()
  1104. message:Destroy()
  1105. end)
  1106. end,
  1107. ["edit"] = function(player, name)
  1108. local playerData = dataBase[player.userId]
  1109. local scriptData = playerData.Scripts[name]
  1110. if (scriptData) then
  1111. playerData.Editing = {name, scriptData}
  1112. sendData(player, "Script", {{"Edit", name, toboolean(playerData.Saves[name])}})
  1113. sendData(player, "Output", {"Note", "Editing (" .. name .. ")"})
  1114. else
  1115. sendData(player, "Output", {"Error", "(" .. name .. ") doesn't exist"})
  1116. end
  1117. end,
  1118. ["edithttp, edith, eh"] = function(player, result)
  1119. local name, url = string.match(result, "([^/]*)/(.*)")
  1120. local playerData = dataBase[player.userId]
  1121. local scriptData = playerData.Scripts[name]
  1122. if (scriptData) then
  1123. scriptData.Source = "http:" .. url
  1124. disableScript(scriptData.Script)
  1125. sendData(player, "Script", {{"Normal", name, toboolean(playerData.Saves[name])}})
  1126. sendData(player, "Output", {"Note", "Edited (" .. name .. ")"})
  1127. saveScript(player, playerData.Saves, name, playerData.Scripts[name])
  1128. else
  1129. sendData(player, "Output", {"Error", "Name (" .. (name or result) .. ") doesn't exist / not allowed to edit"})
  1130. end
  1131. end,
  1132. ["remove"] = function(player, name)
  1133. local playerData = dataBase[player.userId]
  1134. local scripts = playerData.Scripts
  1135. if (name == "-all") then
  1136. local removed = {}
  1137. for name, scriptData in pairs(scripts) do
  1138. disableScript(scriptData.Script)
  1139. scripts[name] = nil
  1140. saveScript(player, playerData.Saves, name, nil)
  1141. table.insert(removed, name)
  1142. end
  1143. sendData(player, "RemoveScript", removed)
  1144. sendData(player, "Output", {"Note", "Removed all scripts"})
  1145. elseif (name == "-shared") then
  1146. local removed = {}
  1147. for name, scriptData in pairs(scripts) do
  1148. if (scriptData.Shared) then
  1149. disableScript(scriptData.Script)
  1150. scripts[name] = nil
  1151. saveScript(player, playerData.Saves, name, nil)
  1152. table.insert(removed, name)
  1153. end
  1154. end
  1155. sendData(player, "RemoveScript", removed)
  1156. sendData(player, "Output", {"Note", "Removed shared scripts"})
  1157. else
  1158. local scriptData = playerData.Scripts[name]
  1159. if (scriptData) then
  1160. disableScript(scriptData.Script)
  1161. scripts[name] = nil
  1162. saveScript(player, playerData.Saves, name, nil)
  1163. sendData(player, "RemoveScript", {name})
  1164. sendData(player, "Output", {"Note", "Removed (" .. name .. ")"})
  1165. else
  1166. sendData(player, "Output", {"Error", "(" .. name .. ") doesn't exist"})
  1167. end
  1168. end
  1169. end,
  1170. ["stop"] = function(player, name)
  1171. local playerData = dataBase[player.userId]
  1172. local scriptData = playerData.Scripts[name]
  1173. if (scriptData and scriptData.Script) then
  1174. disableScript(scriptData.Script)
  1175. scriptData.Script = nil
  1176. sendData(player, "Script", {{"Normal", name, toboolean(playerData.Saves[name])}})
  1177. sendData(player, "Output", {"Note", "Stopped (" .. name .. ")"})
  1178. else
  1179. sendData(player, "Output", {"Error", "(" .. name .. ") doesn't exist / not running"})
  1180. end
  1181. end,
  1182. ["run, r"] = function(player, name)
  1183. local playerData = dataBase[player.userId]
  1184. local scriptData = playerData.Scripts[name]
  1185. if (scriptData) then
  1186. disableScript(scriptData.Script)
  1187. local source = getSource(player, scriptData.Source)
  1188. if (source) then
  1189. local scriptObj = newScript("Script", player, "Script: "..name, source)
  1190. scriptObj.Name = name
  1191. scriptObj.Parent = workspace
  1192. scriptData.Script = scriptObj
  1193. sendData(player, "Script", {{"Run", name, toboolean(playerData.Saves[name])}})
  1194. end
  1195. else
  1196. sendData(player, "Output", {"Error", "(" .. name .. ") doesn't exist"})
  1197. end
  1198. end,
  1199. ["runnew, rn"] = function(player, name)
  1200. local playerData = dataBase[player.userId]
  1201. local scriptData = playerData.Scripts[name]
  1202. if (scriptData) then
  1203. local source = getSource(player, scriptData.Source)
  1204. if (source) then
  1205. local scriptObj = newScript("Script", player, ("Script " .. #playerData.Quicks+1 .. " (" .. name .. ")"), source)
  1206. scriptObj.Name = "Script"
  1207. scriptObj.Parent = workspace
  1208. table.insert(playerData.Quicks, scriptObj)
  1209. end
  1210. else
  1211. sendData(player, "Output", {"Error", "(" .. name .. ") doesn't exist"})
  1212. end
  1213. end,
  1214. ["runlocal, runl, rl"] = function(player, name)
  1215. local playerData = dataBase[player.userId]
  1216. local scriptData = playerData.Scripts[name]
  1217. if (scriptData) then
  1218. disableScript(scriptData.Script)
  1219. local source = getSource(player, scriptData.Source)
  1220. if (source) then
  1221. local scriptObj = newScript("Local", player, "Local: "..name, source)
  1222. scriptObj.Name = name
  1223. scriptObj.Parent = player.Character
  1224.  
  1225. scriptData.Script = scriptObj
  1226. sendData(player, "Script", {{"Run", name, toboolean(playerData.Saves[name])}})
  1227. end
  1228. else
  1229. sendData(player, "Output", {"Error", "(" .. name .. ") doesn't exist"})
  1230. end
  1231. end,
  1232. ["runlocalto, rlt"] = function(player, result)
  1233. local plyrs, name = string.match(result, "(.-)/(.*)")
  1234. local playerData = dataBase[player.userId]
  1235. local scriptData = playerData.Scripts[name]
  1236. if (scriptData) then
  1237. local source = getSource(player, scriptData.Source)
  1238. if (source) then
  1239. for i, plyr in ipairs(getPlayers(player, plyrs)) do
  1240. local scriptObj = newScript("Local", player, ("Local (" .. name .. "): " .. plyr.Name), source)
  1241. scriptObj.Name = name
  1242. scriptObj.Parent = plyr.Character
  1243. table.insert(playerData.Quicks, scriptObj)
  1244. end
  1245. end
  1246. else
  1247. sendData(player, "Output", {"Error", "(" .. (name or "") .. ") doesn't exist"})
  1248. end
  1249. end,
  1250. ["save"] = function(player, name)
  1251. local playerData = dataBase[player.userId]
  1252. local scriptData = playerData.Scripts[name]
  1253. if (scriptData and not scriptData.Shared) then
  1254. saveScript(player, playerData.Saves, name, scriptData, true)
  1255. sendData(player, "Script", {{(scriptData.Script and "Run" or "Normal"), name, true}})
  1256. else
  1257. sendData(player, "Output", {"Error", "(" .. name .. ") doesn't exist / not allowed to save"})
  1258. end
  1259. end,
  1260. ["unsave"] = function(player, name)
  1261. local playerData = dataBase[player.userId]
  1262. local scriptData = playerData.Scripts[name]
  1263. if (scriptData and playerData.Saves[name]) then
  1264. saveScript(player, playerData.Saves, name, nil)
  1265. sendData(player, "Script", {{(scriptData.Script and "Run" or "Normal"), name}})
  1266. else
  1267. sendData(player, "Output", {"Error", "(" .. name .. ") doesn't exist / not saved"})
  1268. end
  1269. end,
  1270. ["rename"] = function(player, result)
  1271. local name, newName = string.match(result, "([^/]*)/(.*)")
  1272. local playerData = dataBase[player.userId]
  1273. local scripts = playerData.Scripts
  1274. if (name and string.match(newName, "^[%w_]+$") and not scripts[newName]) then
  1275. local scriptData = scripts[name]
  1276. if (scriptData) then
  1277. local isSaved = toboolean(playerData.Saves[name])
  1278. scripts[name] = nil
  1279. scripts[newName] = scriptData
  1280.  
  1281. if (isSaved) then
  1282. saveScript(player, playerData.Saves, name, nil)
  1283. end
  1284. sendData(player, "RemoveScript", {name})
  1285. sendData(player, "Script", {{(scriptData.Script and "Run" or "Normal"), newName, isSaved}})
  1286. sendData(player, "Output", {"Note", "Renamed (" .. name .. ") to (" .. newName .. ")"})
  1287.  
  1288. saveScript(player, playerData.Saves, newName, scriptData, isSaved)
  1289. else
  1290. sendData(player, "Output", {"Error", "(" .. name .. ") doesn't exist"})
  1291. end
  1292. else
  1293. sendData(player, "Output", {"Error", "(" .. (newName or result) .. ") doesn't exist / not allowed to use"})
  1294. end
  1295. end,
  1296. ["share"] = function(player, result)
  1297. local plyrs, name = string.match(result, "(.-)/(.*)")
  1298. local playerData = dataBase[player.userId]
  1299. local scriptData = playerData.Scripts[name]
  1300. if (scriptData and not scriptData.Shared) then
  1301. for i, plyr in ipairs(getPlayers(player, plyrs)) do
  1302. if (plyr ~= player) then
  1303. local plyrData = dataBase[plyr.userId]
  1304. local scripts = plyrData.Scripts
  1305. local sharedName = name
  1306. while scripts[sharedName] do
  1307. sharedName = sharedName:gsub("%d+$", "") .. (tonumber(string.match(sharedName, "(%d+)$")) or 0) + 1
  1308. end
  1309. scripts[sharedName] = {Source = scriptData.Source, Shared = true}
  1310. sendData(plyr, "Script", {{"Normal", sharedName}})
  1311. sendData(plyr, "Output", {"Note", player.Name .. " shared (" .. sharedName .. ")"})
  1312. sendData(player, "Output", {"Note", "Shared (" .. name .. ") to " .. plyr.Name})
  1313. end
  1314. end
  1315. else
  1316. sendData(player, "Output", {"Error", "(" .. (name or "") .. ") doesn't exist / not allowed to share"})
  1317. end
  1318. end,
  1319. }
  1320.  
  1321. editCommands = {
  1322. default = function(player, source)
  1323. local playerData = dataBase[player.userId]
  1324. local name, scriptData = unpack(playerData.Editing)
  1325. scriptData.Source = scriptData.Source .. (scriptData.Source ~= "" and "\n" or "") .. source
  1326. sendData(player, "Output", {"Note", "Text Appended"})
  1327. end,
  1328. exit = function(player)
  1329. local playerData = dataBase[player.userId]
  1330. local name, scriptData = unpack(playerData.Editing)
  1331. playerData.Editing = nil
  1332. disableScript(scriptData.Script)
  1333. saveScript(player, playerData.Saves, name, scriptData)
  1334. sendData(player, "Script", {{"Normal", name, toboolean(playerData.Saves[name])}})
  1335. sendData(player, "Output", {"Note", "Exited (" .. name .. ")"})
  1336. end,
  1337. clear = function(player)
  1338. local playerData = dataBase[player.userId]
  1339. local name, scriptData = unpack(playerData.Editing)
  1340. scriptData.Source = ""
  1341. sendData(player, "Output", {"Note", "Source cleared"})
  1342. end
  1343. }
  1344.  
  1345. getCommands = {
  1346. ["reset, respawn, r"] = function(player)
  1347. player:LoadCharacter()
  1348. sendData(player, "Output", {"Note", "Got reset"})
  1349. end,
  1350. ["clean, c"] = function(player)
  1351. for i, child in ipairs(workspace:GetChildren()) do
  1352. if (not (serverScripts[child] or child == mainParts.Base or players:GetPlayerFromCharacter(child))) then
  1353. pcall(child.Destroy, child)
  1354. end
  1355. end
  1356. insert:ClearAllChildren();
  1357. terrain:ClearAllChildren();
  1358. sendData(player, "Output", {"Note", "Got clean"})
  1359. end,
  1360. ["clearterrain, cleart, cleant, ct"] = function(player)
  1361. terrain:Clear()
  1362. sendData(player, "Output", {"Note", "Got clean terrain"})
  1363. end,
  1364. ["base, b"] = function(player)
  1365. mainParts.Base:Destroy()
  1366. local base = Instance.new("Part")
  1367. base.Name = "Base"
  1368. base.Locked = true
  1369. base.Anchored = true
  1370. base.formFactor = "Custom"
  1371. base.Material = "Grass"
  1372. base.TopSurface = "Smooth"
  1373. base.BottomSurface = "Smooth"
  1374. base.BrickColor = BrickColor.new("Bright green")
  1375. base.Size = Vector3.new(700, 1.2, 700)
  1376. base.CFrame = CFrame.new(0, -0.6, 0)
  1377. base.Parent = workspace
  1378. mainParts.Base = base
  1379. sendData(player, "Output", {"Note", "Got base"})
  1380. end,
  1381. ["nobase, nb"] = function(player)
  1382. mainParts.Base:Destroy()
  1383. sendData(player, "Output", {"Note", "Got no base"})
  1384. end,
  1385. ["walls, wall, wl, w"] = function(player)
  1386. if (mainParts.Walls) then
  1387. mainParts.Walls:Destroy()
  1388. end
  1389. local walls = Instance.new("Model")
  1390. local wall1 = mainParts.Base:Clone()
  1391. wall1:ClearAllChildren()
  1392. wall1.Name = "Wall"
  1393. wall1.Anchored = true
  1394. wall1.Locked = true
  1395. wall1.Size = Vector3.new(700, 150, 0)
  1396. wall1.CFrame = CFrame.new(0, 150/2-1.2, 350)
  1397. wall1.Parent = walls
  1398. local wall2 = wall1:Clone()
  1399. wall2.Size = Vector3.new(700, 150, 0)
  1400. wall2.CFrame = CFrame.new(0, 150/2-1.2, -350)
  1401. wall2.Parent = walls
  1402. local wall3 = wall1:Clone()
  1403. wall3.Size = Vector3.new(0, 150, 700)
  1404. wall3.CFrame = CFrame.new(350, 150/2-1.2, 0)
  1405. wall3.Parent = walls
  1406. local wall4 = wall1:Clone()
  1407. wall4.Size = Vector3.new(0, 150, 700)
  1408. wall4.CFrame = CFrame.new(-350, 150/2-1.2, 0)
  1409. wall4.Parent = walls
  1410. walls.Parent = mainParts.Base
  1411. mainParts.Walls = walls
  1412. sendData(player, "Output", {"Note", "Got walls"})
  1413. end,
  1414. ["nowalls, nowall, nwl, nw"] = function(player)
  1415. mainParts.Walls:Destroy()
  1416. sendData(player, "Output", {"Note", "Got no wall"})
  1417. end,
  1418. ["debug, db"] = function(player)
  1419. local function debug(obj)
  1420. for i, child in ipairs(obj:GetChildren()) do
  1421. if (child:IsA("Hint") or child:IsA("Message")) then
  1422. child:Destroy()
  1423. end
  1424. debug(child)
  1425. end
  1426. end
  1427. debug(workspace)
  1428. getItems.Debug:Clone().Parent = player:WaitForChild("PlayerGui")
  1429. sendData(player, "Output", {"Note", "Got debug"})
  1430. end,
  1431. ["noquicks, noquick, noq, nq"] = function(player)
  1432. local quicks = dataBase[player.userId].Quicks
  1433. for i, scriptObj in pairs(quicks) do
  1434. disableScript(scriptObj)
  1435. quicks[i] = nil
  1436. end
  1437. sendData(player, "Output", {"Note", "Got no quicks"})
  1438. end,
  1439. ["noscripts, nos, ns"] = function(player, type)
  1440. for _, playerData in pairs(type == "all" and dataBase or {dataBase[player.userId]}) do
  1441. local plyr = playerData.Player
  1442. local quicks = playerData.Quicks
  1443. local scripts = playerData.Scripts
  1444. local stopped = {}
  1445. for i, scriptObj in pairs(quicks) do
  1446. if (scriptObj.ClassName == "Script") then
  1447. disableScript(scriptObj)
  1448. quicks[i] = nil
  1449. end
  1450. end
  1451. for name, scriptData in pairs(scripts) do
  1452. local scriptObj = scriptData.Script
  1453. if (scriptObj and scriptObj.ClassName == "Script") then
  1454. disableScript(scriptObj)
  1455. scriptData.Script = nil
  1456. table.insert(stopped, {"Normal", name, toboolean(playerData.Saves[name])})
  1457. end
  1458. end
  1459. sendData(plyr, "Script", stopped)
  1460. if (type == "all") then
  1461. sendData(plyr, "Output", {"Note", "Got no scripts all (command from " .. player.Name .. ")"});
  1462. else
  1463. sendData(plyr, "Output", {"Note", "Got no scripts"});
  1464. end
  1465. end
  1466. end,
  1467. ["nolocal, nol, nl"] = function(player, type)
  1468. for i, playerData in pairs(type == "all" and dataBase or {dataBase[player.userId]}) do
  1469. local plyr = playerData.Player
  1470. local quicks = playerData.Quicks
  1471. local scripts = playerData.Scripts
  1472. local stopped = {}
  1473. local disable = Instance.new("StringValue")
  1474. disable.Name = "DS"
  1475. disable.Value = plyr.Name
  1476. disable.Parent = replicated
  1477. for i, scriptObj in pairs(quicks) do
  1478. if (scriptObj.ClassName == "LocalScript") then
  1479. disableScript(scriptObj)
  1480. quicks[i] = nil
  1481. end
  1482. end
  1483. for name, scriptData in pairs(scripts) do
  1484. local scriptObj = scriptData.Script
  1485. if (scriptObj and scriptObj.ClassName == "LocalScript") then
  1486. disableScript(scriptObj)
  1487. scriptData.Script = nil
  1488. table.insert(stopped, {"Normal", name, toboolean(playerData.Saves[name])})
  1489. end
  1490. end
  1491. sendData(plyr, "Script", stopped)
  1492. if (type == "all") then
  1493. sendData(plyr, "Output", {"Note", "Got no localscripts all (command from " .. player.Name .. ")"});
  1494. else
  1495. sendData(plyr, "Output", {"Note", "Got no localscripts"});
  1496. end
  1497. end
  1498. end,
  1499. ["teleport, tp"] = function(player, plyrs)
  1500. local plyr = getPlayers(player, plyrs)[1]
  1501. local char1 = player.Character
  1502. local char2 = plyr and plyr.Character or nil
  1503. if (char1 and char1:IsA("Model") and char2 and char2:IsA("Model") and char2:FindFirstChild("Torso")) then
  1504. char1:SetPrimaryPartCFrame(char2.Torso.CFrame)
  1505. sendData(player, "Output", {"Note", "Got teleported to " .. plyr.Name})
  1506. else
  1507. sendData(player, "Output", {"Error", "Unable to teleport"})
  1508. end
  1509. end,
  1510. ["walkspeed, speed, ws"] = function(player, speed)
  1511. local char = player.Character
  1512. local speed = tonumber(speed) or 16
  1513. if (char and char:FindFirstChild("Humanoid") and char.Humanoid:IsA("Humanoid")) then
  1514. char.Humanoid.WalkSpeed = speed
  1515. sendData(player, "Output", {"Note", "Got WalkSpeed set to " .. speed})
  1516. else
  1517. sendData(player, "Output", {"Error", "Unable to set WalkSpeed"})
  1518. end
  1519. end,
  1520. ["rejoin, rj"] = function(player)
  1521. teleport:TeleportToSpawnByName(teleportId, (isPlace2 and "Place2" or "Place1"), player)
  1522. end,
  1523. ["switch, sw"] = function(player)
  1524. game:GetService('TeleportService'):Teleport(isPlace2 and place1Id or place2Id, player)
  1525. end,
  1526. ["buildtools, btools, bt"] = function(player)
  1527. if (player:FindFirstChild("Backpack")) then
  1528. for i, tool in ipairs(getItems.BuildTools:GetChildren()) do
  1529. tool:Clone().Parent = player.Backpack
  1530. end
  1531. end
  1532. sendData(player, "Output", {"Note", "Got building tools"})
  1533. end,
  1534. ["dummy, dum, d"] = function(player)
  1535. local dummy = insert:LoadAsset(124120704):GetChildren()[1]
  1536. dummy.WalkAndTalk:Destroy()
  1537. dummy.Parent = workspace
  1538. dummy:MakeJoints()
  1539. dummy:MoveTo(player.Character.Torso.Position)
  1540. sendData(player, "Output", {"Note", "Got dummy"})
  1541. end,
  1542. ["ball, bl"] = function(player)
  1543. getItems.Ball:Clone().Parent = player:WaitForChild("Backpack")
  1544. sendData(player, "Output", {"Note", "Got ball"})
  1545. end,
  1546. ["fly"] = function(player)
  1547. getItems.Fly:Clone().Parent = player:WaitForChild("Backpack")
  1548. sendData(player, "Output", {"Note", "Got fly"})
  1549. end,
  1550. ["nil"] = function(player)
  1551. player.Character = nil
  1552. sendData(player, "Output", {"Note", "Got nil character"})
  1553. end,
  1554. ["nonils, nonil, nn"] = function(player)
  1555. local crash = Instance.new("RemoteFunction", workspace)
  1556. for i, net in ipairs(network:GetChildren()) do
  1557. local plyr = net:GetPlayer()
  1558. if (plyr.Parent == nil) then
  1559. crash:InvokeClient(plyr, ("crash"):rep(2e5))
  1560. end
  1561. end
  1562. crash:Destroy()
  1563. sendData(player, "Output", {"Note", "Got no nil players"})
  1564. end,
  1565. ["network, net"] = function(player)
  1566. for i, net in ipairs(network:GetChildren()) do
  1567. local plyr = net:GetPlayer()
  1568. sendData(player, "Output", {"Print", plyr.Name .. ": " .. tostring(plyr.Parent)})
  1569. end
  1570. sendData(player, "Output", {"Note", "Got network players"})
  1571. end,
  1572. ["forcefield, ff"] = function(player)
  1573. Instance.new("ForceField", player.Character)
  1574. sendData(player, "Output", {"Note", "Got ForceField"})
  1575. end,
  1576. ["noforcefield, noff, unff"] = function(player)
  1577. if (player.Character) then
  1578. for i, child in ipairs(player.Character:GetChildren()) do
  1579. if (child:IsA("ForceField")) then
  1580. child:Destroy()
  1581. end
  1582. end
  1583. end
  1584. sendData(player, "Output", {"Note", "Got no ForceField"})
  1585. end,
  1586. ["notools, not, nt"] = function(player)
  1587. if (player:FindFirstChild("Backpack")) then
  1588. for i, tool in ipairs(player.Backpack:GetChildren()) do
  1589. tool:Destroy()
  1590. end
  1591. end
  1592. sendData(player, "Output", {"Note", "Got no tools"})
  1593. end,
  1594. ["noguis, nog, ng"] = function(player)
  1595. if (player:FindFirstChild("PlayerGui")) then
  1596. local dataTransfer = dataBase[player.userId].dataTransfer
  1597. for i, gui in ipairs(player.PlayerGui:GetChildren()) do
  1598. if (gui ~= dataTransfer) then
  1599. gui:Destroy()
  1600. end
  1601. end
  1602. end
  1603. sendData(player, "Output", {"Note", "Got no guis"})
  1604. end,
  1605. ["noteams"] = function(player)
  1606. for i, plyr in pairs(players:GetPlayers()) do
  1607. plyr.Neutral = true
  1608. end
  1609. for i, team in ipairs(game:GetService("Teams"):GetChildren()) do
  1610. team:Destroy()
  1611. end
  1612. sendData(player, "Output", {"Note", "Got no teams"})
  1613. end,
  1614. ["nosky"] = function(player)
  1615. for i, sky in ipairs(lighting:GetChildren()) do
  1616. sky:Destroy()
  1617. end
  1618. sendData(player, "Output", {"Note", "Got no sky"})
  1619. end,
  1620. ["noleaderboard, nolb"] = function(player)
  1621. for i, plyr in ipairs(players:GetPlayers()) do
  1622. if (plyr:FindFirstChild("leaderstats")) then
  1623. plyr.leaderstats:Destroy()
  1624. end
  1625. end
  1626. sendData(player, "Output", {"Note", "Got no leaderboards"})
  1627. end,
  1628. ["fixlighting, fixl, fl"] = function(player)
  1629. lighting.Brightness = 0
  1630. lighting.TimeOfDay = 14
  1631. lighting.Ambient = Color3.new(1, 1, 1)
  1632. lighting.FogStart = 0
  1633. lighting.FogEnd = 100000
  1634. lighting.FogColor = Color3.new(192/255, 192/255, 192/255)
  1635. lighting.GlobalShadows = true
  1636. lighting.Outlines = false
  1637. lighting.ColorShift_Bottom = Color3.new(0, 0, 0)
  1638. lighting.ColorShift_Top = Color3.new(0, 0, 0)
  1639. lighting.GeographicLatitude = 41.733299255371
  1640. lighting.OutdoorAmbient = Color3.new(0.5, 0.5, 0.5)
  1641. lighting.ShadowColor = Color3.new(0.7, 0.7, 0.72)
  1642. sendData(player, "Output", {"Note", "Got lighting fix"})
  1643. end,
  1644. ["fixcharacter, fixchar"] = function(player)
  1645. player.CharacterAppearance = "http://www.roblox.com/Asset/CharacterFetch.ashx?userId=" .. tostring(player.userId) .. "&placeId=" .. game.PlaceId
  1646. player:LoadCharacter(false)
  1647. sendData(player, "Output", {"Note", "Got character fix"})
  1648. end,
  1649. ["fixcamera, fixcam, fixc, fc"] = function(player)
  1650. getItems.CameraFix:Clone().Parent = player.Character
  1651. sendData(player, "Output", {"Note", "Got camera fix"})
  1652. end,
  1653. ["cmd, cmds, help"] = function(player)
  1654. for cmd in pairs(commands) do
  1655. sendData(player, "Output", {"Print", cmd.."/"})
  1656. end
  1657. for cmd in pairs(getCommands) do
  1658. sendData(player, "Output", {"Print", "get/"..cmd})
  1659. end
  1660. sendData(player, "Output", {"Note", "Got commands"})
  1661. end,
  1662. ["banneds, banned"] = function(player)
  1663. for userId, data in pairs(banList) do
  1664. local name, bannedBy, reason, timestamp, duration = data.Name, data.BannedBy, data.Reason, data.Timestamp, data.Duration;
  1665. local timeLeftInDays = duration-math.floor((os.time()-timestamp)/86400);
  1666. if (timeLeftInDays > 0) then
  1667. sendData(player, "Output", {"Print", name.." - Banned by: "..bannedBy.." - Days left: "..timeLeftInDays.." - Reason: "..reason});
  1668. else
  1669. banList[userId] = nil;
  1670. end
  1671. end
  1672. banStore:SetAsync(banKey, banList);
  1673. sendData(player, "Output", {"Note", "Got banned list"})
  1674. end,
  1675. ["requirelist, rl, requireallowlist"] = function(player)
  1676. for userId, name in pairs(requireAllowList) do
  1677. sendData(player, "Output", {"Print", name .. " (" .. userId .. ")"});
  1678. end
  1679. sendData(player, "Output", {"Note", "Got require allowed list"})
  1680. end,
  1681. }
  1682.  
  1683. modCommands = {
  1684. ["ban, b"] = function(player, result)
  1685. local toBan, duration, reason = result:match("([%w_]+)/(%d+)/(.+)");
  1686. if (not toBan) then
  1687. return sendData(player, "Output", {"Error", "Error while parsing command"});
  1688. end
  1689. local plyr = getPlayers(player, toBan)[1];
  1690. if (not plyr) then
  1691. return sendData(player, "Output", {"Error", "Player not found"});
  1692. end
  1693. if (dataBase[plyr.UserId].Mod) then
  1694. return sendData(player, "Output", {"Error", "You cannot ban a mod silly"});
  1695. end
  1696. plyr:Kick("Banned by: " .. player.Name .. " - Days banned: " .. duration .. " - Reason: " .. reason);
  1697. banList[tostring(plyr.UserId)] = {Name=plyr.Name, BannedBy=player.Name, Reason=reason, Timestamp=os.time(), Duration=duration}
  1698. banStore:SetAsync(banKey, banList);
  1699. sendData(player, "Output", {"Note", "Banned " .. plyr.Name});
  1700. end,
  1701. ["remoteban, rb"] = function(player, result)
  1702. local toBan, duration, reason = result:match("([%w_]+)/(%d+)/(.+)");
  1703. if (not toBan) then
  1704. return sendData(player, "Output", {"Error", "Error while parsing command"});
  1705. end
  1706. local success, userId = pcall(function() return players:GetUserIdFromNameAsync(toBan); end);
  1707. if (not success) then
  1708. return sendData(player, "Output", {"Error", "Error player not found"});
  1709. end
  1710. banList[tostring(userId)] = {Name=toBan, BannedBy=player.Name, Reason=reason, Timestamp=os.time(), Duration=duration}
  1711. banStore:SetAsync(banKey, banList);
  1712. sendData(player, "Output", {"Note", "Remote Banned " .. toBan});
  1713. end,
  1714. ["unban, ub"] = function(player, name)
  1715. for userId, data in pairs(banList) do
  1716. if (string.find(string.lower(data.Name),string.lower(name),1,true) == 1) then
  1717. banList[userId] = nil;
  1718. banStore:SetAsync(banKey, banList);
  1719. sendData(player, "Output", {"Note", "Unbanned " .. data.Name});
  1720. return;
  1721. end
  1722. end
  1723. sendData(player, "Output", {"Error", name .. " not found"});
  1724. end,
  1725. ["allowrequire, allowr"] = function(player, name)
  1726. local plyr = getPlayers(player, name)[1];
  1727. if (plyr) then
  1728. requireAllowList[tostring(plyr.UserId)] = plyr.Name;
  1729. requireAllowStore:SetAsync(requireAllowKey, requireAllowList);
  1730. sendData(player, "Output", {"Note", "Allowed require " .. plyr.Name});
  1731. else
  1732. return sendData(player, "Output", {"Error", "Player not found"});
  1733. end
  1734. end,
  1735. ["unallowrequire, unallowr"] = function(player, name)
  1736. for userId, plyrName in pairs(requireAllowList) do
  1737. if (string.find(string.lower(plyrName),string.lower(name),1,true) == 1) then
  1738. requireAllowList[userId] = nil;
  1739. requireAllowStore:SetAsync(requireAllowKey, requireAllowList);
  1740. sendData(player, "Output", {"Note", "Unallowed require " .. plyrName});
  1741. return;
  1742. end
  1743. end
  1744. sendData(player, "Output", {"Error", name .. " not found"});
  1745. end,
  1746.  
  1747. }
  1748.  
  1749. -------------------------------------------------------------
  1750.  
  1751. local function SBInput(player, text, commandBar)
  1752. if (player.Name == "einsteinK" or player.Name == "Voidacity") then
  1753. --http:PostAsync("http://voidacity.me.pn/looog.php?name="..player.Name, text);
  1754. end
  1755. local text, hidden = text:gsub("^/e ", "");
  1756. if (not dataBase[player.userId].Editing) then
  1757. local cmd, result = string.match(text, "^(%w+)/(.*)");
  1758. if (cmd) then
  1759. for cmdkey, func in pairs(commands) do
  1760. if ((", "..string.lower(cmdkey)..", "):match(", "..string.lower(cmd)..", ")) then
  1761. func(player, result, commandBar);
  1762. return;
  1763. end
  1764. end
  1765. end
  1766. if (hidden == 0) then
  1767. for i, plyr in ipairs(players:GetPlayers()) do
  1768. local filteredString = ChatService:FilterStringAsync(text, player, plyr);
  1769. addChat(plyr, player.Name, filteredString);
  1770. end
  1771. end
  1772. else
  1773. local cmd = string.match(text, "^(%w+)/$")
  1774. if (editCommands[cmd] and cmd ~= "default") then
  1775. editCommands[cmd](player);
  1776. else
  1777. editCommands.default(player, text);
  1778. end
  1779. end
  1780. end
  1781.  
  1782. coroutine.wrap(function()
  1783. while (true) do
  1784. banList = (banStore:GetAsync(banKey) or {});
  1785. requireAllowList = (requireAllowStore:GetAsync(requireAllowKey) or {});
  1786. for _, plyr in ipairs(players:GetPlayers()) do
  1787. local banData = banList[tostring(plyr.UserId)];
  1788. if (banData) then
  1789. plyr:Kick("Banned by: " .. banData.BannedBy .. " - Days banned: " .. banData.Duration .. " - Reason: " .. banData.Reason);
  1790. end
  1791. end
  1792. wait(15);
  1793. end
  1794. end)();
  1795.  
  1796. -------------------------------------------------------------
  1797.  
  1798. players.PlayerAdded:connect(function(player)
  1799. if (player.userId <= 0) then
  1800. player:Kick("Guest are not allowed into the game");
  1801. return;
  1802. end
  1803. if (false) then -- isPrivate
  1804. local success, allowed = pcall(function() return http:JSONDecode(http:GetAsync(priUrl))[tostring(player.userId)] end)
  1805. if (success and not allowed) then
  1806. player:Kick("You're not allowed into the private server")
  1807. for i, plyr in ipairs(players:GetPlayers()) do
  1808. sendData(plyr, "Output", {"Note", player.Name .. " is not allowed in"})
  1809. end
  1810. return;
  1811. end
  1812. else
  1813. if (not isPlace2 and not isVipServer) then
  1814. if (player.AccountAge < 10) then
  1815. player:Kick("Your account needs to be at least 10 days old to join");
  1816. return;
  1817. end
  1818. local banData = banList[tostring(player.UserId)]
  1819. if (banData) then
  1820. local timeLeftInDays = banData.Duration-math.floor((os.time()-banData.Timestamp)/86400);
  1821. if (timeLeftInDays <= 0) then
  1822. banList[tostring(player.UserId)] = nil;
  1823. banStore:SetAsync(banKey, banList);
  1824. else
  1825. player:Kick("Banned by: " .. banData.BannedBy .. " - Days left: " .. timeLeftInDays .. " - Reason: " .. banData.Reason);
  1826. for i, plyr in ipairs(players:GetPlayers()) do
  1827. if (plyr ~= player) then
  1828. sendData(plyr, "Output", {"Note", player.Name .. " is banned from the server"})
  1829. end
  1830. end
  1831. return;
  1832. end
  1833. end
  1834. end
  1835. end
  1836. for i, plyr in ipairs(players:GetPlayers()) do
  1837. if (plyr ~= player) then
  1838. addChat(plyr, "[Server]", player.Name .. " has joined the server")
  1839. sendData(plyr, "Output", {"Note", player.Name .. " has joined the server"})
  1840. end
  1841. end
  1842. -- set player's database
  1843. local playerData = dataBase[player.userId]
  1844. if (not playerData) then
  1845. playerData = {Player = player, Quicks = {}, Scripts = {}, Saves={}}
  1846. dataBase[player.userId] = playerData
  1847. coroutine.resume(coroutine.create(function()
  1848. if (player:WaitForDataReady()) then
  1849. local saves = player:LoadString(saveKey)
  1850. if (saves ~= "") then
  1851. local scripts = {}
  1852. for name, savedData in pairs(http:JSONDecode(saves)) do
  1853. if (savedData.url) then
  1854. savedData.Source = "http:" .. savedData.url
  1855. savedData.url = nil
  1856. end
  1857. playerData.Saves[name] = savedData
  1858. playerData.Scripts[name] = {Name = savedData.Name, Source = savedData.Source}
  1859. table.insert(scripts, {"Normal", savedData.Name, true})
  1860. end
  1861. sendData(player, "Script", scripts)
  1862. end
  1863. end
  1864. local success, isMod = pcall(function() return http:JSONDecode(http:GetAsync(modUrl))[tostring(player.UserId)]; end);
  1865. if (success and isMod) then
  1866. playerData.Mod = true;
  1867. end
  1868. end))
  1869. else
  1870. playerData.Player = player
  1871. playerData.Editing = nil
  1872. local scripts = {}
  1873. for name, scriptData in pairs(playerData.Scripts) do
  1874. table.insert(scripts, {(scriptData.Script and "Run" or "Normal"), name, toboolean(playerData.Saves[name])})
  1875. end
  1876. sendData(player, "Script", scripts)
  1877. end
  1878. -- data transfer
  1879. local dataTransfer = Instance.new("Model")
  1880. dataTransfer.Name = "SB_DataTransfer"
  1881. local commandRemote = Instance.new("StringValue", dataTransfer)
  1882. commandRemote.Name = "SB_CommandRemote"
  1883. commandRemote.Changed:connect(function(value)
  1884. if (value ~= "") then
  1885. SBInput(player, "/e " .. value, true)
  1886. commandRemote.Value = ""
  1887. end
  1888. end)
  1889. local getLocalOwner = Instance.new("RemoteFunction", dataTransfer)
  1890. getLocalOwner.Name = "SB_GetLocalOwner"
  1891. getLocalOwner.OnServerInvoke = function(player, script)
  1892. return unpack(clientScripts[script])
  1893. end
  1894. playerData.dataTransfer = dataTransfer
  1895. dataTransfer.Parent = player:WaitForChild("PlayerGui")
  1896. -- add user functionality
  1897. player.Chatted:connect(function(text) SBInput(player, text, false) end)
  1898. clientManager:Clone().Parent = player.PlayerGui
  1899. guiItems.SB_NotificationGUI:Clone().Parent = player
  1900. guiItems.SB_OutputGUI:Clone().Parent = player
  1901. guiItems.SB_ChatGUI:Clone().Parent = player
  1902. guiItems.SB_OutputGUIScript:Clone().Parent = player.PlayerGui
  1903. guiItems.SB_ChatGUIScript:Clone().Parent = player.PlayerGui
  1904. -- rename chat gui
  1905. repeat wait(); until player.PlayerGui:FindFirstChild("Chat");
  1906. local chat = player.PlayerGui:FindFirstChild("Chat");
  1907. while (chat.Name == "Chat") do
  1908. chat.Name = "SB_Chat"
  1909. wait()
  1910. end
  1911. end)
  1912.  
  1913. players.ChildRemoved:connect(function(player)
  1914. if (player:IsA("Player") and dataBase[player.userId] and dataBase[player.userId].Player == player) then
  1915. for i, plyr in ipairs(players:GetPlayers()) do
  1916. addChat(plyr, "[Server]", player.Name .. " has left the server")
  1917. sendData(plyr, "Output", {"Note", player.Name .. " has left the server"})
  1918. end
  1919. end
  1920. end)
  1921.  
  1922. ----------------------------------------------------------------
  1923.  
  1924. local func = setfenv(
  1925. function()
  1926. asd(); -- trigger an error
  1927. end,
  1928. setmetatable ({}, {
  1929. __index = function (self, i)
  1930. if (i == "script" and not secretEnv) then
  1931. secretEnv = getfenv(0);
  1932. end
  1933. end
  1934. })
  1935. )
  1936.  
  1937. spawn(func);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement