DrawingJhon

VSB Portable (Alpha)

Nov 24th, 2020 (edited)
11,298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 136.89 KB | None | 0 0
  1. ----------------------------------------------------------------------
  2. --// VOIDACITY'S SCRIPT BUILDER PORTABLE \\--
  3. -- Script compatible by DrawingJhon | Original made by tusKOr661 --
  4. ----------------------------------------------------------------------
  5.  
  6. wait()
  7. script.Name = "oxSB"
  8. script.Parent = nil
  9.  
  10. local Version = "Alpha v2.2.11"
  11.  
  12. local DS_Key = "6F05FAED-6EA6-4E95-9204-123"
  13. local psKey = "PrivServsrRand0m7qe8"
  14. local saveKey = "ScIi1221Tfq1bOiLdr"
  15. local banKey = "ScRiPp0tB0I1derbln2"
  16. local loadstringEnabled = pcall(loadstring, "local hello = 'hi'")
  17. local Loadstring = require(5343495217)
  18. local LoadLibrary = require(4960288388)
  19. local req = require(6505718551)
  20. local EAenabled = false
  21. local CreateScript = req.NS
  22. local CreateLocal = req.NLS
  23.  
  24. local players = game:GetService("Players")
  25. local network = game:GetService("NetworkServer")
  26. local insert = game:GetService("InsertService")
  27. local teleport = game:GetService("TeleportService")
  28. local http = game:GetService("HttpService")
  29. local terrain = workspace.Terrain
  30. local context = game:GetService("ScriptContext")
  31. local replicated = game:GetService("ReplicatedStorage")
  32. local lighting = game:GetService("Lighting")
  33. local dataStore = game:GetService("DataStoreService")
  34. local startergui = game:GetService("StarterGui")
  35. local tweenService = game:GetService("TweenService")
  36. local mainData = dataStore:GetDataStore(DS_Key, "dy3BrMu2ieAHZgz@kIXcG&t&q9ru")
  37. local btools = (function()
  38.     local success, result = pcall(function()
  39.         return getfenv(require(6877105817)).script["Building Tools"]:Clone()
  40.     end)
  41.     if not success then
  42.         warn(":SB_Error (Unable to get f3x from module): "..tostring(result))
  43.     else
  44.         return result
  45.     end
  46. end)()
  47.  
  48. if req.Initialized then
  49.     warn("Voidacity's Script Builder is already running! Aborting...")
  50.     script:Destroy()
  51.     return
  52. end
  53.  
  54. req.Initialized = true
  55.  
  56. local Moderators = {
  57.     [652513366] = "JhonXD2006",
  58.     [1308042355] = "DrawingJhon",
  59.     [760209609] = "Artem1237894",
  60.     [1693560309] = "PotatoPruebas",
  61.     [442923944] = "hacker57934"
  62. }
  63. local Members = {
  64.     [907012872] = "ignasi29",
  65.     [428609829] = "Axelle63",
  66.     [688322357] = "tacomexicano_ROBLOX",
  67.     [1521766652] = "FernandoPlayerYT",
  68.     [308254638] = "Robloxmastermanyay"
  69. }
  70.  
  71. local DefDummy = insert:LoadAsset(124120704):GetChildren()[1]
  72. DefDummy.Name = "Default Dummy"
  73. DefDummy.WalkAndTalk:Destroy()
  74. local scriptBase = getfenv(require(4889063407).load).script:GetChildren()[1]:Clone()
  75. scriptBase.Name = "Script"
  76. scriptBase.Disabled = false
  77. local CrossManager
  78.  
  79. local dataBase = {}
  80. local serverScripts = {}
  81. local clientScripts = {}
  82. local scriptEnvs = {}
  83. local infoEnvs = {}
  84. local scripts = {}
  85. local connections = {}
  86. local serverList = {}
  87.  
  88. local banList = {}
  89. local gBanList = mainData:GetAsync(banKey) or {}
  90. local PrivateServers = mainData:GetAsync(psKey) or {}
  91. local mainParts = {}
  92.  
  93. local reals = setmetatable({}, {__mode = "k"})
  94. local proxies = setmetatable({}, {__mode = "v"})
  95. local sandboxEnabled = loadstringEnabled and true or false -- this cause lag if loadstring is not enabled
  96. local alertIY = true
  97. local mainEnv = getfenv(0)
  98. mainEnv.script = nil
  99. local mainEnvFunc = setfenv(1, mainEnv)
  100. 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, require=true}
  101. local isA = game.IsA
  102. local proxyObj, newProxyEnv, hookClient;
  103.  
  104. local _G, game, script, getfenv, setfenv, workspace,
  105. getmetatable, setmetatable, loadstring, coroutine,
  106. rawequal, typeof, print, math, warn, error,  pcall,
  107. xpcall, select, rawset, rawget, ipairs, pairs,
  108. next, Rect, Axes, os, tick, Faces, unpack, string, Color3,
  109. newproxy, tostring, tonumber, Instance, TweenInfo, BrickColor,
  110. NumberRange, ColorSequence, NumberSequence, ColorSequenceKeypoint,
  111. NumberSequenceKeypoint, PhysicalProperties, Region3int16,
  112. Vector3int16, elapsedTime, require, table, type, wait,
  113. Enum, UDim, UDim2, Vector2, Vector3, Region3, CFrame, Ray, spawn =
  114.     _G, game, script, getfenv, setfenv, workspace,
  115.     getmetatable, setmetatable, loadstring, coroutine,
  116.     rawequal, typeof, print, math, warn, error,  pcall,
  117.     xpcall, select, rawset, rawget, ipairs, pairs,
  118.     next, Rect, Axes, os, tick, Faces, unpack, string, Color3,
  119.     newproxy, tostring, tonumber, Instance, TweenInfo, BrickColor,
  120.     NumberRange, ColorSequence, NumberSequence, ColorSequenceKeypoint,
  121.     NumberSequenceKeypoint, PhysicalProperties, Region3int16,
  122.     Vector3int16, elapsedTime, require, table, type, wait,
  123.     Enum, UDim, UDim2, Vector2, Vector3, Region3, CFrame, Ray, spawn
  124.  
  125. local secretEnv;
  126.  
  127. ------------------------------------------------------
  128.  
  129. local encode, decode
  130. do
  131.     local Key53 = 8186484168865098
  132.     local Key14 = 4887
  133.     local inv256
  134.     function encode(str)
  135.         if not inv256 then
  136.             inv256 = {}
  137.             for M = 0, 127 do
  138.                 local inv = -1
  139.                 repeat inv = inv + 2
  140.                 until inv * (2*M + 1) % 256 == 1
  141.                 inv256[M] = inv
  142.             end
  143.         end
  144.         local K, F = Key53, 16384 + Key14
  145.         return (str:gsub('.', function(m)
  146.             local L = K % 274877906944  -- 2^38
  147.             local H = (K - L) / 274877906944
  148.             local M = H % 128
  149.             m = m:byte()
  150.             local c = (m * inv256[M] - (H - M) / 128) % 256
  151.             K = L * F + H + c + m
  152.             return ('%02x'):format(c)
  153.         end))
  154.     end
  155.     function decode(str)
  156.         local K, F = Key53, 16384 + Key14
  157.         return (str:gsub('%x%x', function(c)
  158.             local L = K % 274877906944  -- 2^38
  159.             local H = (K - L) / 274877906944
  160.             local M = H % 128
  161.             c = tonumber(c, 16)
  162.             local m = (c + (H - M) / 128) * (2*M + 1) % 256
  163.             K = L * F + H + c + m
  164.             return string.char(m)
  165.         end))
  166.     end
  167. end
  168.  
  169. local function Routine(f, ...)
  170.     return coroutine.resume(coroutine.create(f), ...)
  171. end
  172.  
  173. local function emptyFunction()
  174.     -- There's nothing to see...
  175. end
  176.  
  177. local function isInstance(obj)
  178.     return pcall(isA, obj, "Instance")
  179. end
  180.  
  181. local function toboolean(value)
  182.     return not not value;
  183. end
  184.  
  185. local function WaitForChildOfClass(obj, class)
  186.     local find = game.findFirstChildOfClass
  187.     local object = find(obj, class)
  188.     if not object then
  189.         repeat game:GetService("RunService").Stepped:wait()
  190.             object = find(obj, class)
  191.         until object
  192.     end
  193.     return object
  194. end
  195.  
  196. local function splitStr(str, key)
  197.     local tab = {};
  198.     for part in string.gmatch(str..key, "(.-)"..key) do
  199.         table.insert(tab, part);
  200.     end
  201.     return tab;
  202. end
  203.  
  204. local function repackToFunc(func, ...) 
  205.     local tab = {num = select("#", ...), ...}
  206.     for i = 1, tab.num do
  207.         tab[i] = func(tab[i])
  208.     end
  209.     return unpack(tab, 1, tab.num)
  210. end
  211.  
  212. local function isDestroyed(obj)
  213.     if obj.Parent then return false end
  214.     local success, err = pcall(function()
  215.         obj.Parent = obj
  216.     end)
  217.     if err:lower():match("locked") then
  218.         return true
  219.     end
  220.     return false
  221. end
  222.  
  223. local function Pcall(func, ...)
  224.     local args = {pcall(func, ...)}
  225.     if not args[1] then
  226.         warn("SB_ERROR: "..tostring(args[2]))
  227.     end
  228.     return unpack(args)
  229. end
  230.  
  231. local function getFormattedTime(sec)
  232.     sec = tonumber(sec) or tick()
  233.     return ("%.2d:%.2d:%.2d"):format(sec/3600%24, sec/60%60, sec%60)
  234. end
  235.  
  236. local function SetGlobalBan(userId, value)
  237.     rawset(gBanList, tostring(userId), value)
  238.     mainData:UpdateAsync(banKey, function(tab)
  239.         local newTab = type(tab) == "table" and tab or {}
  240.         newTab[tostring(userId)] = value
  241.         return newTab
  242.     end)
  243. end
  244.  
  245. local function RemoveGlobalBan(userId)
  246.     SetGlobalBan(userId, nil)
  247. end
  248.  
  249. local function getServerType()
  250.     if game.PrivateServerId ~= "" then
  251.         if game.PrivateServerOwnerId ~= 0 then
  252.             return "VIP Server"
  253.         else
  254.             return "Private Server"
  255.         end
  256.     else
  257.         return "Public Server"
  258.     end
  259. end
  260.  
  261. local function sendData(player, dtype, data)
  262.     local player = (type(player) == "userdata") and player or players:findFirstChild(player);
  263.     if player and player:IsA("Player") then
  264.         local playerData = dataBase[player.UserId]
  265.         if playerData and playerData.SB then
  266.             local dataEntry = Instance.new("StringValue")
  267.             dataEntry.Name = "SB_Output:"..dtype
  268.             dataEntry.Value = http:JSONEncode(data)
  269.             dataEntry.Parent = player
  270.         end
  271.     end
  272. end
  273.  
  274. local function SaveString(player, strKey, str)
  275.     mainData:UpdateAsync(strKey, function(tab)
  276.         local saves = type(tab) == "table" and tab or {}
  277.         saves[tostring(player.UserId)] = str
  278.         return saves
  279.     end)
  280. end
  281.  
  282. local function LoadString(player, strKey)
  283.     local key = saveKey
  284.     local saves = mainData:GetAsync(key)
  285.     if type(saves) == "table" then
  286.         local result = saves[tostring(player.UserId)]
  287.         return type(result) == "string" and result or ""
  288.     end
  289.     return ""
  290. end
  291.  
  292. local function OnPlayerAdded(func)
  293.     for i, plyr in pairs(players:GetPlayers()) do
  294.         coroutine.wrap(func)(plyr)
  295.     end
  296.     return players.PlayerAdded:Connect(func)
  297. end
  298.  
  299. local function getSource(player, source)
  300.     local url = string.match(source, "^http:(.+)");
  301.     if (url) then
  302.         local success, response = pcall(http.GetAsync, http, url);
  303.         if (success) then
  304.             source = response;
  305.         else
  306.             source = nil;
  307.             sendData(player, "Output", {"Error", "Unable to get url '" .. url .. "'"});
  308.         end
  309.     end
  310.     return source;
  311. end
  312.  
  313. local function saveScript(player, saves, name, scriptData, newSave)
  314.     if (newSave or saves[name]) then
  315.         if (scriptData) then
  316.             saves[name] = {Name = name, Source = scriptData.Source};
  317.             sendData(player, "Output", {"Note", (newSave and "Saved" or "Updated") .. " ("..name..")"});
  318.         else
  319.             saves[name] = nil;
  320.             sendData(player, "Output", {"Note", "Unsaved ("..name..")"});
  321.         end
  322.         coroutine.wrap(SaveString)(player, saveKey, http:JSONEncode(saves));
  323.     end
  324. end
  325.  
  326. local function getPlayers(player, plyrs)
  327.     local result = {};
  328.     if (plyrs == "all") then
  329.         result = players:GetPlayers();
  330.     elseif (plyrs == "others") then
  331.         for i, plyr in ipairs(players:GetPlayers()) do
  332.             if (plyr ~= player) then
  333.                 table.insert(result, plyr);
  334.             end
  335.         end
  336.     else
  337.         for i, plyr in ipairs(players:GetPlayers()) do
  338.             local dupl = false;
  339.             for i, input in ipairs(splitStr(string.lower(plyrs), ", ")) do
  340.                 if (not dupl and string.find(string.lower(plyr.Name), input, 1, true) == 1) then
  341.                     table.insert(result, plyr);
  342.                     dupl = true;
  343.                 end
  344.             end
  345.         end
  346.     end
  347.     return result
  348. end
  349.  
  350. local function newScript(type, owner, name, source)
  351.     local scriptObj
  352.     if type == "Script" then
  353.         if not loadstringEnabled then
  354.             scriptObj = CreateScript([==[local error = error
  355.             local Loadstring, source = require(6505718551).Inject(script)
  356.             local func, err = Loadstring(source, pcall(loadstring, "") and "SB_Script" or getfenv(0))
  357.             if func then
  358.                 setfenv(func, getfenv(0))
  359.                 spawn(func)
  360.             else
  361.                 error(err)
  362.             end]==])
  363.             serverScripts[scriptObj] = {owner, name, source}
  364.             scriptObj.Name = "Script"
  365.         else
  366.             local runner = Instance.new("BindableFunction")
  367.             runner.OnInvoke = function()
  368.                 return function(db)
  369.                     if db then return end
  370.                     local scr = scriptObj
  371.                     if serverScripts[scr] and not serverScripts[scr][4] then
  372.                         local y, err = loadstring(source, "SB_Script")
  373.                         if y then
  374.                             err = nil
  375.                         end
  376.                         local owner, name, source = unpack(serverScripts[scr])
  377.                         local env = newProxyEnv(scr, owner)
  378.                         serverScripts[scr][4] = env
  379.                         serverScripts[scr][5] = scr:GetFullName()
  380.                         scriptEnvs[env] = owner
  381.                         connections[env] = {}
  382.                         infoEnvs[env] = {Script = scr, Proxy = sandboxEnabled}
  383.                         table.insert(scripts, scr)
  384.                         setfenv(0, env)
  385.                         setfenv(2, env)
  386.                         local v2 = getfenv(2)
  387.                         v2.getfenv = function(lvl)
  388.                             if err then return 0 end
  389.                             return (function()
  390.                                 v2.getfenv = nil
  391.                                 return "SB_Script"
  392.                             end)()
  393.                         end
  394.                         sendData(owner, "Output", {"Run", "Running ("..name..")"})
  395.                         return err and error or loadstring, err or source
  396.                     else
  397.                         return coroutine.yield
  398.                     end
  399.                 end
  400.             end
  401.             runner.Name = "Runner"
  402.             scriptObj = scriptBase:Clone()
  403.             serverScripts[scriptObj] = {owner, name, source}
  404.             spawn(function()
  405.                 runner.Parent = scriptObj
  406.             end)
  407.         end
  408.     elseif type == "Local" then
  409.         local errInSource
  410.         local source = Loadstring(source) and source or (function()
  411.             local a, b = Loadstring(source)
  412.             errInSource = b
  413.             return ""
  414.         end)()
  415.         scriptObj = CreateLocal(([[
  416.         owner = game:GetService("Players").LocalPlayer
  417.         local print, warn, LoadLibrary = print, warn, nil
  418.         do
  419.             local game, Instance, tostring, select, owner = game, Instance, tostring, select, owner
  420.             local realPrint, realWarn = print, warn
  421.             local info = script:WaitForChild("Info")
  422.             local name, err = unpack(game:GetService("HttpService"):JSONDecode(info.Value))
  423.             local haz = false
  424.             if getmetatable(shared) == "Full locked" then
  425.                 shared(script, name)
  426.                 haz = true
  427.             elseif shared.Init then
  428.                 shared.Init(script, name)
  429.                 haz = true
  430.             end
  431.             local function sendData(dtype, data)
  432.                 if haz then
  433.                     local dataEntry = Instance.new("StringValue")
  434.                     dataEntry.Name = "SB_Output:"..dtype
  435.                     dataEntry.Value = game:GetService("HttpService"):JSONEncode(data)
  436.                     dataEntry.Parent = owner
  437.                 else
  438.                     if data[1] == "Print" then
  439.                         realPrint(data[2])
  440.                     elseif data[1] == "Warn" then
  441.                         realWarn(data[2])
  442.                     end
  443.                 end
  444.             end
  445.             function LoadLibrary(idk)
  446.                 return {Create = function(object)
  447.                     local ob = Instance.new(object)
  448.                     return function(properties)
  449.                         if typeof(properties) == "table" then
  450.                             for pr, val in pairs(properties) do
  451.                                 ob[pr] = val
  452.                             end
  453.                         end
  454.                         return ob
  455.                     end
  456.                 end}
  457.             end
  458.             print = function(...)
  459.                 local args = {...}
  460.                 local md = {}
  461.                 for i = 1, select("#", ...) do
  462.                     md[i] = tostring(args[i]);
  463.                 end
  464.                 sendData("Output", {"Print", table.concat(md, "    ")});
  465.             end
  466.             warn = function(...)
  467.                 local args = {...}
  468.                 local md = {}
  469.                 for i = 1, select("#", ...) do
  470.                     md[i] = tostring(args[i]);
  471.                 end
  472.                 sendData("Output", {"Warn", table.concat(md, "    ")});
  473.             end
  474.             sendData("Output", {"Run", "Running ("..name..")"})
  475.             if err then
  476.                 error(err)
  477.             end
  478.         end ]]):gsub("\n", " ")..source)
  479.         clientScripts[scriptObj] = {owner, name}
  480.         local Info = Instance.new("StringValue")
  481.         Info.Value = http:JSONEncode({name, errInSource})
  482.         Info.Name = "Info"
  483.         Info.Parent = scriptObj
  484.     end
  485.     return scriptObj
  486. end
  487.  
  488. local function disableScript(script)
  489.     if script then
  490.         if serverScripts[script] then
  491.             if serverScripts[script][4] then
  492.                 local env = serverScripts[script][4]
  493.                 if connections[env] then
  494.                     for i, conn in pairs(connections[env]) do
  495.                         if typeof(conn) == "RBXScriptConnection" then
  496.                             if conn.Connected then
  497.                                 conn:Disconnect()
  498.                             end
  499.                         end
  500.                     end
  501.                 end
  502.                 scriptEnvs[env] = nil
  503.             end
  504.             serverScripts[script] = nil
  505.         elseif clientScripts[script] then
  506.             clientScripts[script] = nil
  507.         end
  508.         script:Destroy()
  509.     end
  510. end
  511.  
  512. ----------------------------------------------------
  513.  
  514. local customLibrary = {
  515.     print = function(...)
  516.         local owner = scriptEnvs[getfenv(0)]
  517.         local args = {...}
  518.         for i = 1, select("#", ...) do
  519.             args[i] = tostring(args[i]);
  520.         end
  521.         sendData(owner.Name, "Output", {"Print", table.concat(args, "\t")});
  522.     end,
  523.     warn = function(...)
  524.         local owner = scriptEnvs[getfenv(0)];
  525.         local args = {...};
  526.         for i = 1, select("#", ...) do
  527.             args[i] = tostring(args[i]);
  528.         end
  529.         sendData(owner.Name, "Output", {"Warn", table.concat(args, "\t")})
  530.     end,
  531.     ["newScript,NS"] = function(...)
  532.         local source, parent = select(1, ...), select(2, ...)
  533.         assert(select("#", ...) ~= 0, "NS: missing argument #1 to 'NS' (string expected)")
  534.         assert(type(source) == "string", "NS: invalid argument #1 to 'NS' (string expected, got "..typeof(source)..")")
  535.         assert(select("#", ...) ~= 1, "NS: missing argument #2 to 'NS' (Instance expected)")
  536.         assert(typeof(parent) == "Instance", "NS: invalid argument #2 to 'NS' (Instance expected, got "..typeof(parent)..")")
  537.         local owner = scriptEnvs[getfenv(0)]
  538.         local scriptObj = newScript("Script", owner, "NS - "..parent:GetFullName(), source)
  539.         scriptObj.Parent = parent
  540.         table.insert(dataBase[owner.userId].Quicks, scriptObj)
  541.         return scriptObj
  542.     end,
  543.     ["newLocalScript,NLS"] = function(...)
  544.         local source, parent = select(1, ...), select(2, ...)
  545.         assert(select("#", ...) ~= 0, "NLS: missing argument #1 to 'NLS' (string expected)")
  546.         assert(type(source) == "string", "NLS: invalid argument #1 to 'NLS' (string expected, got "..typeof(source)..")")
  547.         assert(select("#", ...) ~= 1, "NLS: missing argument #2 to 'NLS' (Instance expected)")
  548.         assert(typeof(parent) == "Instance", "NLS: invalid argument #2 to 'NLS' (Instance expected, got "..typeof(parent)..")")
  549.         local owner = scriptEnvs[getfenv(0)]
  550.         local scriptObj = newScript("Local", owner, "NLS - "..parent:GetFullName(), source)
  551.         scriptObj.Parent = parent
  552.         table.insert(dataBase[owner.userId].Quicks, scriptObj)
  553.         return scriptObj
  554.     end,
  555.     ["getfenv"] = function(arg)
  556.         local typ = type(arg);
  557.         local env;
  558.         if (typ == "number" and arg >= 0) then
  559.             local lvl = (arg == 0 and 0 or arg+1);
  560.             env = getfenv(lvl);
  561.         elseif (typ == "nil") then
  562.             env = getfenv(2);
  563.         elseif (typ == "function") then
  564.             if (reals[arg]) then
  565.                 env = getfenv(0);
  566.             else
  567.                 env = getfenv(arg);
  568.             end
  569.         else
  570.             getfenv(arg);
  571.         end
  572.         if (env == secretEnv) then
  573.             return {"nawp"};
  574.         elseif (env == mainEnv) then
  575.             return getfenv(0);
  576.         else
  577.             return env;
  578.         end
  579.     end,
  580.     ["setfenv"] = function(...)
  581.         local arg, tbl = select(1, ...), select(2, ...)
  582.         assert(select("#", ...) > 1, "missing argument #2 to 'setfenv' (table expected)")
  583.         local typ = type(arg);
  584.         local func;
  585.         if (typ == "number" and arg >= 0) then
  586.             local lvl = (arg == 0 and 0 or arg+1);
  587.             func = setfenv(lvl, tbl);
  588.         elseif (typ == "function") then
  589.             if (reals[arg]) then
  590.                 error("'setfenv' cannot change environment of given object");
  591.             else
  592.                 func = setfenv(arg, tbl);
  593.             end
  594.         else
  595.             setfenv(arg, tbl);
  596.         end
  597.         if (func == mainEnvFunc) then
  598.             setfenv(mainEnvFunc, mainEnv);
  599.             error("Error occured setfenv");
  600.         else
  601.             return func;
  602.         end
  603.     end,
  604.     ["LoadLibrary"] = function(library)
  605.         local library = type(library) == "string" and library:gsub("^.", string.upper) or error("Bad argument")
  606.         if not infoEnvs[getfenv(0)].Proxy then
  607.             return LoadLibrary(library)
  608.         end
  609.         if (library == "RbxUtility") then
  610.             local lib = LoadLibrary("RbxUtility");
  611.             local userdata = newproxy(true);
  612.             local tab = {};
  613.             getmetatable(userdata).__index = function(_, index)
  614.                 return (tab[index]);
  615.             end
  616.             getmetatable(userdata).__tostring = function()
  617.                 return "RbxUtility"
  618.             end
  619.             getmetatable(userdata).__metatable = "The metatable is locked"
  620.             function tab.CreateSignal()
  621.                 local ud = newproxy(true)
  622.                 local this = {};
  623.                 local mBindableEvent = proxyObj(Instance.new("BindableEvent"));
  624.                 local mAllCns = {};
  625.                 function this.connect(self, ...)
  626.                     local func = select(1, ...)
  627.                     if (self ~= ud) then error("Expected ':' not '.' calling member function Connect", 2); end
  628.                     assert(select("#", ...) ~= 0, "missing argument #1 to 'Connect' (function expected)")
  629.                     if (type(func) ~= "function") then
  630.                         error("invalid argument #1 to 'Connect' (function expected, got "..type(func)..")", 2);
  631.                     end
  632.                     local cn = mBindableEvent.Event:Connect(func);
  633.                     mAllCns[cn] = true;
  634.                     local pubCn = {};
  635.                     local ud = newproxy(true)
  636.                     local mt = getmetatable(ud)
  637.                     local function disconnect(self)
  638.                         if self ~= ud then error("Expected ':' not '.' calling member function Disconnect") end
  639.                         cn:disconnect();
  640.                         mAllCns[cn] = nil;
  641.                     end
  642.                     local function connected(self)
  643.                         if self ~= ud then error("Expected ':' not '.' calling member function Connected") end
  644.                         return cn.Connected
  645.                     end
  646.                     pubCn.Connected = connected
  647.                     pubCn.connected = connected
  648.                     pubCn.disconnect = disconnect
  649.                     pubCn.Disconnect = disconnect
  650.                     mt.__index = pubCn
  651.                     mt.__tostring = function(self)
  652.                         return "Connection"
  653.                     end
  654.                     return ud;
  655.                 end
  656.                 function this.disconnect(self)
  657.                     if (self ~= ud) then error("Expected ':' not '.' calling member function Disconnect", 2); end
  658.                     for cn, _ in pairs(mAllCns) do
  659.                         cn:disconnect();
  660.                         mAllCns[cn] = nil;
  661.                     end
  662.                 end
  663.                 function this.wait(self)
  664.                     if (self ~= ud) then error("Expected ':' not '.' calling member function Wait", 2); end
  665.                     return mBindableEvent.Event:wait();
  666.                 end
  667.                 function this.fire(self, ...)
  668.                     if (self ~= ud) then error("Expected ':' not '.' calling member function Fire", 2); end
  669.                     mBindableEvent:Fire(...);
  670.                 end
  671.                 for i, v in pairs(this) do
  672.                     this[i:gsub("^.", string.upper)] = v
  673.                 end
  674.                 local meta = getmetatable(ud)
  675.                 meta.__index = function(self, index)
  676.                     return this[index]
  677.                 end
  678.                 meta.__tostring = function(self)
  679.                     return "RbxUtility Signal"
  680.                 end
  681.                 meta.__metatable = "The metatable is locked"
  682.                 return ud;
  683.             end
  684.             local function Create_PrivImpl(objectType)
  685.                 if (type(objectType) ~= "string") then
  686.                     error("Argument of Create must be a string", 2);
  687.                 end
  688.                 return function(dat)
  689.                     dat = (dat or {});
  690.                     local obj = proxyObj(Instance.new(objectType));
  691.                     local ctor = nil;
  692.                     for k, v in pairs(dat) do
  693.                         if (type(k) == "string") then
  694.                             obj[k] = v;
  695.                         elseif (type(k) == "number") then
  696.                             if (type(v) ~= "userdata") then
  697.                                 error("Bad entry in Create body: Numeric keys must be paired with children, got a: "..type(v), 2);
  698.                             end
  699.                             v.Parent = obj;
  700.                         elseif (type(k) == "table" and k.__eventname) then
  701.                             if (type(v) ~= "function") then
  702.                                 error("Bad entry in Create body: Key `[Create.E\'"..k.__eventname.."\']` must have a function value\
  703.                                        got: "..tostring(v), 2);
  704.                             end
  705.                             obj[k.__eventname]:connect(v);
  706.                         elseif (k == tab.Create) then
  707.                             if (type(v) ~= "function") then
  708.                                 error("Bad entry in Create body: Key `[Create]` should be paired with a constructor function, \
  709.                                        got: "..tostring(v), 2);
  710.                             elseif (ctor) then
  711.                                 error("Bad entry in Create body: Only one constructor function is allowed", 2);
  712.                             end
  713.                             ctor = v;
  714.                         else
  715.                             error("Bad entry ("..tostring(k).." => "..tostring(v)..") in Create body", 2);
  716.                         end
  717.                     end
  718.                     if (ctor) then
  719.                         ctor(obj);
  720.                     end
  721.                     return obj;
  722.                 end
  723.             end
  724.             tab.Create = setmetatable({}, {__call = function(tb, ...) return Create_PrivImpl(...) end});
  725.             tab.Create.E = function(eventName)
  726.                 return {__eventname = eventName};
  727.             end
  728.             return userdata;
  729.         elseif LoadLibrary(library) then
  730.             local Library = proxyObj(LoadLibrary(library))
  731.             local userdata = newproxy(true)
  732.             local meta = getmetatable(userdata)
  733.             meta.__index = function(self, index)
  734.                 return Library[index]
  735.             end
  736.             meta.__tostring = function(self)
  737.                 return library
  738.             end
  739.             meta.__metatable = "The metatable is locked"
  740.             return userdata
  741.         else
  742.             error("Invalid library name")
  743.         end
  744.     end,
  745.     ["require"] = function(obj)
  746.         local id = tonumber(obj) or nil
  747.         if id then
  748.             local owner = scriptEnvs[getfenv(0)]
  749.             local playerData = dataBase[owner.UserId]
  750.             table.insert(playerData.Requires, {RequireId = id, Name = owner.Name, UserId = owner.userId, Time = tick()})
  751.         end
  752.         return require(reals[obj] or obj)
  753.     end,
  754.     _G = setmetatable({}, {__metatable = "The metatable is locked."}),
  755.     shared = setmetatable({}, {__metatable = "The metatable is locked."})
  756. }
  757.  
  758. local customLibrary2 = {}
  759.  
  760. local customProperties = {
  761.     ["onread:Part:Explode,explode"] = function(obj)
  762.         if not isInstance(obj) or obj.ClassName ~= "Part" then error("Expected ':' not '.' calling member function Explode") end
  763.         Instance.new("Explosion", obj).Position = obj.Position
  764.     end,
  765.     ["onread:Player:Explode,explode"] = function(self)
  766.         if not isInstance(self) or self.ClassName ~= "Player" then error("Expected ':' not '.' calling member function Explode") end
  767.         local part = self.Character and self.Character:findFirstChildOfClass("Part")
  768.         if part then
  769.             Instance.new("Explosion", part).Position = part.Position
  770.         else
  771.             error("Unable to explode player")
  772.         end
  773.     end,
  774.     ["onread:Player:RunLocalScript,runLocalScript,RLS"] = function(plr, ...)
  775.         if not isInstance(plr) or plr.ClassName ~= "Player" then error("Expected ':' not '.' calling member function RunLocalScript") end
  776.         local source = select(1, ...)
  777.         if source == nil then error("Argument 1 missing or nil") end
  778.         if type(source) ~= "string" then error("invalid argument #1 to 'RunLocalScript' (string expected, got "..typeof(source)..")") end
  779.         local owner = scriptEnvs[getfenv(0)]
  780.         local char = plr.Character
  781.         local scriptObj = newScript("Local", plr, "NLS - "..char:GetFullName(), source)
  782.         scriptObj.Parent = char
  783.         table.insert(dataBase[owner.userId].Quicks, scriptObj)
  784.         return scriptObj
  785.     end,
  786.     ["onread:Instance:Remove,remove"] = function(self, ...)
  787.         if not isInstance(self) then error("Expected ':' not '.' calling member function Remove") end
  788.         local owner = scriptEnvs[getfenv(0)]
  789.         if not dataBase[owner.userId].Mod then
  790.             if self.ClassName == "Player" then
  791.                 error("Player is locked")
  792.             end
  793.             if self.ClassName == "PlayerGui" then
  794.                 error("PlayerGui is locked")
  795.             end
  796.             if self.ClassName == "Backpack" then
  797.                 error("Backpack is locked")
  798.             end
  799.         end
  800.         return self:Remove(...)
  801.     end,
  802.     ["onread:Instance:Destroy,destroy"] = function(self, ...)
  803.         if not isInstance(self) then error("Expected ':' not '.' calling member function Destroy") end
  804.         local owner = scriptEnvs[getfenv(0)]
  805.         if not dataBase[owner.userId].Mod then
  806.             if self.ClassName == "Player" then
  807.                 error("Player is locked")
  808.             end
  809.             if self.ClassName == "PlayerGui" then
  810.                 error("PlayerGui is locked")
  811.             end
  812.             if self.ClassName == "Backpack" then
  813.                 error("Backpack is locked")
  814.             end
  815.         end
  816.         return self:Destroy(...)
  817.     end,
  818.     ["onread:Instance:ClearAllChildren,clearAllChildren"] = function(self, ...)
  819.         if not isInstance(self) then error("Expected ':' not '.' calling member function ClearAllChildren") end
  820.         local owner = scriptEnvs[getfenv(0)]
  821.         if not dataBase[owner.userId].Mod then
  822.             if self.ClassName == "Players" then
  823.                 error("Player is locked")
  824.             end
  825.             if self.ClassName == "Player" then
  826.                 error("Cannot ClearAllChildren Player")
  827.             end
  828.             if self.ClassName == "PlayerGui" and self.Parent ~= owner then
  829.                 error("Cannot ClearAllChildren PlayerGui")
  830.             end
  831.         end
  832.         return self:ClearAllChildren(...)
  833.     end,
  834.     ["onread:Instance:WaitForChild,waitForChild"] = function(self, ...)
  835.         if not isInstance(self) then error("Expected ':' not '.' calling member function WaitForChild") end
  836.         local childName, timeOut = select(1, ...), select(2, ...)
  837.         local lastFullName = self:GetFullName()
  838.         local owner = scriptEnvs[getfenv(0)]
  839.         local child
  840.         local stack = debug.traceback("", 0)
  841.         coroutine.wrap(function()
  842.             wait(5)
  843.             if type(timeOut) ~= "number" and not child then
  844.                 if not scriptEnvs[getfenv(0)] then error("Script ended") end
  845.                 local message = "Infinite yield possible on '"..lastFullName..":WaitForChild(\""..childName.."\")'"
  846.                 local name = serverScripts[infoEnvs[getfenv(0)].Script][2]
  847.                 local editedStack = "\n"
  848.                 for i, line in ipairs(splitStr(string.sub(stack, 1, -2), "\n")) do
  849.                     local line = string.gsub(line, "^SB_Script:(%d+)", "[string \"SB_Script\"], line %1")
  850.                     local line = string.gsub(line, "^(.-) (function.+)", "%1 - %2")
  851.                     local source, errLine = string.match(line, "(.+), (.+)")
  852.                     if (source == "[string \"SB_Script\"]") then
  853.                         editedStack = editedStack .. "[" .. name .. "], " .. errLine  .. "\n"
  854.                     end
  855.                 end
  856.                 local st = string.gsub(string.sub(editedStack, 1, -2), "(, .-) %- [^\n]+$", "%1")
  857.                 sendData(owner.Name, "Output", {"Info", message, st})
  858.             end
  859.         end)()
  860.         child = self:WaitForChild(...)
  861.         return child
  862.     end,
  863.     ["onread:Player:Kick,kick"] = function(self, ...)
  864.         if not isInstance(self) or self.ClassName ~= "Player" then error("Expected ':' not '.' calling member function Kick") end
  865.         local owner = scriptEnvs[getfenv(0)]
  866.         if not dataBase[owner.userId].Mod then
  867.             error("Player is locked")
  868.         else
  869.             return self:Kick(...)
  870.         end
  871.     end,
  872.     ["onedit:Player:Parent"] = function(self, val)
  873.         local owner = scriptEnvs[getfenv(0)]
  874.         if not dataBase[owner.userId].Mod then
  875.             error("Player is locked")
  876.         end
  877.         self.Parent = val
  878.     end,
  879.     ["onread:Debris:AddItem,addItem"] = function(self, ...)
  880.         if (not isInstance(self) or self.ClassName ~= "Debris") then error("Expected ':' not '.' calling member function AddItem"); end
  881.         local owner = scriptEnvs[getfenv(0)]
  882.         if not dataBase[owner.userId].Mod then
  883.             local obj = select(1, ...)
  884.             if isInstance(obj) then
  885.                 if obj.ClassName == "Player" then
  886.                     error("Player is locked")
  887.                 end
  888.                 if obj.ClassName == "PlayerGui" then
  889.                     error("PlayerGui is locked")
  890.                 end
  891.                 if obj.ClassName == "Backpack" then
  892.                     error("Backpack is locked")
  893.                 end
  894.             end
  895.         end
  896.         return self:AddItem(...)
  897.     end,
  898.     ["onread:TeleportService:Teleport,teleport"] = function(self, ...)
  899.         if not isInstance(self) or self.ClassName ~= "TeleportService" then error("Expected ':' not '.' calling member function Teleport") end
  900.         local owner = scriptEnvs[getfenv(0)]
  901.         if not dataBase[owner.userId].Mod then
  902.             error("Teleporting is blocked")
  903.         else
  904.             return self:Teleport(...)
  905.         end
  906.     end,
  907.     ["onread:TeleportService:TeleportToPlaceInstance,teleportToPlaceInstance"] = function(self, ...)
  908.         if not isInstance(self) or self.ClassName ~= "TeleportService" then error("Expected ':' not '.' calling member function TeleportToPlaceInstance") end
  909.         local owner = scriptEnvs[getfenv(0)]
  910.         if not dataBase[owner.userId].Mod then
  911.             error("Teleporting is blocked")
  912.         else
  913.             return self:TeleportToPlaceInstance(...)
  914.         end
  915.     end,
  916.     ["onread:TeleportService:TeleportToSpawnByName,teleportToSpawnByName"] = function(self, ...)
  917.         if not isInstance(self) or self.ClassName ~= "TeleportService" then error("Expected ':' not '.' calling member function TeleportToSpawnByName") end
  918.         local owner = scriptEnvs[getfenv(0)]
  919.         if not dataBase[owner.userId].Mod then
  920.             error("Teleport is blocked")
  921.         else
  922.             return self:TeleportToSpawnByName(...)
  923.         end
  924.     end,
  925.     ["onread:RemoteFunction:InvokeClient,invokeClient"] = function(self, ...)
  926.         if (not isInstance(self) or self.ClassName ~= "RemoteFunction") then error("Expected ':' not '.' calling member function InvokeClient"); end
  927.         local player = select(1, ...)
  928.         local owner = scriptEnvs[getfenv(0)]
  929.         if not dataBase[owner.userId].Mod then
  930.             local args = {...};
  931.             for i = 1, select("#",...) do
  932.                 local arg = args[i];
  933.                 if (type(arg) == "string" and #arg > 2e5) then
  934.                     error("You tried to disconnect " .. tostring(player));
  935.                 elseif (type(arg) == "table" and #http:JSONEncode(arg) > 2e5) then
  936.                     error("You tried to disconnect " .. tostring(player));
  937.                 end
  938.             end
  939.         end
  940.         return self:InvokeClient(...);
  941.     end,
  942.     -- RemoteEvent
  943.     ["onread:RemoteEvent:FireClient,fireClient"] = function(self, ...)
  944.         if (not isInstance(self) or self.ClassName ~= "RemoteEvent") then error("Expected ':' not '.' calling member function FireClient"); end
  945.         local player = select(1, ...)
  946.         local player = isInstance(player) and player.ClassName == "Player" and player
  947.         local owner = scriptEnvs[getfenv(0)]
  948.         if not dataBase[owner.userId].Mod then
  949.             local args = {...};
  950.             for i = 1, select("#",...) do
  951.                 local arg = args[i];
  952.                 if (type(arg) == "string" and #arg > 2e5 and player) then
  953.                     error("You tried to disconnect " .. tostring(player));
  954.                 elseif (type(arg) == "table" and #http:JSONEncode(arg) > 2e5 and player) then
  955.                     error("You tried to disconnect " .. tostring(player));
  956.                 end
  957.             end
  958.         end
  959.         return self:FireClient(...);
  960.     end,
  961.     ["onedit:PlayerGui:Parent"] = function(self, parent)
  962.         local owner = scriptEnvs[getfenv(0)]
  963.         if not dataBase[owner.userId].Mod then
  964.             error("PlayerGui is locked")
  965.         end
  966.         self.Parent = parent
  967.     end,
  968.     ["onedit:PlayerGui:Name"] = function(self, name)
  969.         local owner = scriptEnvs[getfenv(0)]
  970.         if not dataBase[owner.userId].Mod then
  971.             error("PlayerGui is locked")
  972.         end
  973.         self.Name = name
  974.     end
  975. }
  976.  
  977. do
  978.     local modifiedCustomProperties = {};
  979.     local modifiedcustomLibrary = {};
  980.     for data, value in next, customProperties do
  981.         local behavior, class, props = string.match(data, "(%a+):(%a+):(.+)");
  982.         for prop in string.gmatch(props, "[^,]+") do
  983.             modifiedCustomProperties[behavior..":"..class..":"..prop] = value;
  984.         end
  985.     end
  986.     for keys, value in next, customLibrary do
  987.         for key in string.gmatch(keys, "[^,]+") do
  988.             modifiedcustomLibrary[key] = value
  989.         end
  990.     end
  991.     customProperties = modifiedCustomProperties;
  992.     customLibrary = modifiedcustomLibrary
  993.     for i, v in pairs(customLibrary) do
  994.         customLibrary2[i] = v
  995.     end
  996.     customLibrary2._G = nil
  997.     customLibrary2.shared = nil
  998. end
  999.  
  1000. function proxyObj(obj)
  1001.     local real = reals[obj];
  1002.     if (real) then
  1003.         return real;
  1004.     end
  1005.     local proxy = proxies[obj];
  1006.     if (proxy) then
  1007.         return proxy;
  1008.     end
  1009.     local typ = type(obj);
  1010.     if (typ == "userdata") then
  1011.         local userdata = newproxy(true);
  1012.         local meta = getmetatable(userdata);
  1013.         if (isInstance(obj)) then
  1014.             local class = obj.ClassName;
  1015.             meta.__index = function(self, index)
  1016.                 local customValue = (customProperties["onread:"..class..":"..index] or customProperties["onread:Instance:"..index]);
  1017.                 if (customValue) then
  1018.                     return proxyObj(customValue);
  1019.                 else
  1020.                     return proxyObj(obj[proxyObj(index)]);
  1021.                 end
  1022.             end
  1023.             meta.__newindex = function(self, index, value)
  1024.                 local onEdit = (customProperties["onedit:"..class..":"..index] or customProperties["onedit:Instance:"..index]);
  1025.                 if (onEdit) then
  1026.                     onEdit(obj, proxyObj(value));
  1027.                 else
  1028.                     obj[proxyObj(index)] = proxyObj(value);
  1029.                 end
  1030.             end
  1031.             meta.__call = function(self, ...)
  1032.                 return repackToFunc(proxyObj, obj(repackToFunc(proxyObj, ...)));
  1033.             end
  1034.         else
  1035.             meta.__index = function(self, index)
  1036.                 return proxyObj(obj[proxyObj(index)]);
  1037.             end
  1038.             meta.__newindex = function(self, index, value)
  1039.                 obj[proxyObj(index)] = proxyObj(value);
  1040.             end
  1041.             meta.__call = function(self, ...)
  1042.                 if scriptEnvs[getfenv(0)] then
  1043.                     return repackToFunc(proxyObj, obj(repackToFunc(proxyObj, ...)));
  1044.                 else
  1045.                     error("Script ended")
  1046.                 end
  1047.             end        
  1048.         end
  1049.         meta.__tostring = function()
  1050.             return tostring(obj);
  1051.         end
  1052.         meta.__concat = function(v1, v2)
  1053.             return proxyObj(proxyObj(v1) .. proxyObj(v2));
  1054.         end
  1055.         meta.__add = function(v1, v2)
  1056.             return proxyObj(proxyObj(v1) + proxyObj(v2));
  1057.         end
  1058.         meta.__sub = function(v1, v2)
  1059.             return proxyObj(proxyObj(v1) - proxyObj(v2));
  1060.         end
  1061.         meta.__mul = function(v1, v2)
  1062.             return proxyObj(proxyObj(v1) * proxyObj(v2));
  1063.          end
  1064.         meta.__div = function(v1, v2)
  1065.             return proxyObj(proxyObj(v1) / proxyObj(v2));
  1066.         end
  1067.         meta.__mod = function(v1, v2)
  1068.             return proxyObj(proxyObj(v1) % proxyObj(v2));
  1069.         end
  1070.         meta.__pow = function(v1, v2)
  1071.             return proxyObj(proxyObj(v1) ^ proxyObj(v2));
  1072.         end
  1073.         meta.__unm = function()
  1074.             return proxyObj(-obj)
  1075.         end
  1076.         meta.__eq = function(v1, v2)
  1077.             return proxyObj(proxyObj(v1) == proxyObj(v2));
  1078.         end
  1079.         meta.__lt = function(v1, v2)
  1080.             return proxyObj(proxyObj(v1) < proxyObj(v2));
  1081.         end
  1082.         meta.__le = function(v1, v2)
  1083.             return proxyObj(proxyObj(v1) <= proxyObj(v2));
  1084.         end
  1085.         meta.__len = function()
  1086.             return proxyObj(#obj);
  1087.         end
  1088.         meta.__metatable = getmetatable(obj);
  1089.         reals[userdata], proxies[obj] = obj, userdata;
  1090.         return userdata;
  1091.     elseif (typ == "function") then
  1092.         local function func(...)
  1093.             if scriptEnvs[getfenv(0)] then
  1094.                 return (function(...)
  1095.                     local fv = select(1, ...)
  1096.                     if typeof(fv) == "RBXScriptConnection" and connections[getfenv(0)] then
  1097.                         table.insert(connections[getfenv(0)], fv)
  1098.                     end
  1099.                     return repackToFunc(proxyObj, ...);
  1100.                 end)(obj(repackToFunc(proxyObj, ...)))
  1101.             else
  1102.                 error("Script ended");
  1103.             end
  1104.         end
  1105.         reals[func], proxies[obj] = obj, func;
  1106.         return func;
  1107.     elseif (typ == "table") then
  1108.         local tab = {};
  1109.         for k, v in next, obj do
  1110.             tab[proxyObj(k)] = proxyObj(v);
  1111.         end
  1112.         if (getmetatable(obj)) then
  1113.             local meta = {};
  1114.             meta.__index = function(self, index)
  1115.                 return proxyObj(obj[proxyObj(index)]);
  1116.             end
  1117.             meta.__newindex = function(self, index, value)
  1118.                 obj[proxyObj(index)] = proxyObj(value);
  1119.             end
  1120.             meta.__call = function(self, ...)
  1121.                 return repackToFunc(proxyObj, obj(repackToFunc(proxyObj, ...)));
  1122.             end
  1123.             meta.__tostring = function()
  1124.                 return tostring(obj);
  1125.             end
  1126.             meta.__concat = function(v1, v2)
  1127.                 return proxyObj(proxyObj(v1) .. proxyObj(v2));
  1128.             end
  1129.             meta.__add = function(v1, v2)
  1130.                 return proxyObj(proxyObj(v1) + proxyObj(v2));
  1131.             end
  1132.             meta.__sub = function(v1, v2)
  1133.                 return proxyObj(proxyObj(v1) - proxyObj(v2));
  1134.             end
  1135.             meta.__mul = function(v1, v2)
  1136.                 return proxyObj(proxyObj(v1) * proxyObj(v2));
  1137.              end
  1138.             meta.__div = function(v1, v2)
  1139.                 return proxyObj(proxyObj(v1) / proxyObj(v2));
  1140.             end
  1141.             meta.__mod = function(v1, v2)
  1142.                 return proxyObj(proxyObj(v1) % proxyObj(v2));
  1143.             end
  1144.             meta.__pow = function(v1, v2)
  1145.                 return proxyObj(proxyObj(v1) ^ proxyObj(v2));
  1146.             end
  1147.             meta.__unm = function()
  1148.                 return proxyObj(-obj)
  1149.             end
  1150.             meta.__eq = function(v1, v2)
  1151.                 return proxyObj(proxyObj(v1) == proxyObj(v2));
  1152.             end
  1153.             meta.__lt = function(v1, v2)
  1154.                 return proxyObj(proxyObj(v1) < proxyObj(v2));
  1155.             end
  1156.             meta.__le = function(v1, v2)
  1157.                 return proxyObj(proxyObj(v1) <= proxyObj(v2));
  1158.             end
  1159.             meta.__len = function()
  1160.                 return proxyObj(#obj);
  1161.             end
  1162.             meta.__metatable = "The metatable is locked (from ox-side)";
  1163.             setmetatable(tab, meta);       
  1164.         end
  1165.         return tab;
  1166.     else
  1167.         return obj;
  1168.     end
  1169. end
  1170.  
  1171. function newProxyEnv(scr, owner)
  1172.     local mt = {}
  1173.     if sandboxEnabled then
  1174.         mt.__index = function(self, index)
  1175.             if not scriptEnvs[getfenv(0)] then error("Script ended") end
  1176.             rawset(mainEnv, index, nil)
  1177.             local lib = customLibrary[index] or mainEnv[index]
  1178.             local isCore = coreLibs[index]
  1179.             if proxies[lib] then
  1180.                 return proxies[lib]
  1181.             end
  1182.             if lib and isCore and type(lib) == "function" and index ~= "getfenv" and index ~= "setfenv" and index ~= "error" then
  1183.                 local func = function(...)
  1184.                     if scriptEnvs[getfenv(0)] then
  1185.                         return lib(...)
  1186.                     else
  1187.                         error("Script ended")
  1188.                     end
  1189.                 end
  1190.                 reals[func] = lib
  1191.                 proxies[lib] = func
  1192.                 return func
  1193.             elseif lib then
  1194.                 if isCore then
  1195.                     return lib
  1196.                 else
  1197.                     return proxyObj(lib)
  1198.                 end
  1199.             else
  1200.                 return rawget(customLibrary._G, index)
  1201.             end
  1202.         end
  1203.     else
  1204.         local wrappeds = setmetatable({}, {__mode = "k"})
  1205.         mt.__index = function(self, index)
  1206.             if not scriptEnvs[getfenv(0)] then error("Script ended") end
  1207.             rawset(mainEnv, index, nil)
  1208.             local lib = customLibrary2[index] or mainEnv[index]
  1209.             if wrappeds[lib] then
  1210.                 return wrappeds[lib]
  1211.             end
  1212.             if type(lib) == "function" then
  1213.                 local func = function(...)
  1214.                     if scriptEnvs[getfenv(0)] then
  1215.                         return lib(...)
  1216.                     else
  1217.                         error("Script ended")
  1218.                     end
  1219.                 end
  1220.                 reals[func] = lib
  1221.                 wrappeds[lib] = func
  1222.                 return func
  1223.             end
  1224.             return lib
  1225.         end
  1226.     end
  1227.     mt.__metatable = getmetatable(mainEnv)
  1228.     local env = setmetatable({script = sandboxEnabled and proxyObj(scr) or scr, owner = sandboxEnabled and proxyObj(owner) or owner}, mt)
  1229.     return env
  1230. end
  1231.  
  1232. ------------------------------------------------
  1233.  
  1234. local errorSignal;
  1235. local function scriptError(error, stack, script)
  1236.     if (serverScripts[script]) then
  1237.         local owner, name, source, env, fullName = unpack(serverScripts[script])
  1238.         local editedStack = "\n"
  1239.         if loadstringEnabled then
  1240.             for i, line in ipairs(splitStr(string.sub(stack, 1, -2), "\n")) do
  1241.                 local source, errLine = string.match(line, "(.+), (.+)")
  1242.                 if (source == "[string \"SB_Script\"]") then
  1243.                     editedStack = editedStack .. "[" .. name .. "], " .. errLine .. "\n"
  1244.                 end
  1245.             end
  1246.             local st = string.gsub(string.sub(editedStack, 1, -2), "(, .-) %- [^\n]+$", "%1")
  1247.             sendData(owner.Name, "Output", {"Error", string.gsub(string.gsub(error, "^%[string \"oxSB_Script\"%]:%d+: ", ""), "^.-%[string \"SB_Script\"%]:(%d+)[:%]]?", "["..name.."] :%1:"), st})
  1248.         else
  1249.             for i, line in ipairs(splitStr(string.sub(stack, 1, -2), "\n")) do
  1250.                 local source, errLine = string.match(line, "(.+), (.+)")
  1251.                 if (source == '[string "'..fullName..'"]') then
  1252.                     editedStack = editedStack .. "[" .. name .. "], " .. errLine .. "\n"
  1253.                 end
  1254.             end
  1255.             sendData(owner.Name, "Output", {"Error", string.gsub(string.gsub(error, "^ServerScriptService%.%w+:%d+: ", ""), "^.-%[string \""..fullName.."\"%]:(%d+):", "["..name.."] :%1:"), string.gsub(string.sub(editedStack, 1, -2), "(, .-) %- [^\n]+$", "%1")})
  1256.         end
  1257.     end
  1258. end
  1259. errorSignal = context.Error:Connect(scriptError)
  1260.  
  1261. req.Inject = setmetatable({}, {
  1262.     __call = function(self, scr)
  1263.         if serverScripts[scr] and not serverScripts[scr][4] then
  1264.             local owner, name, source = unpack(serverScripts[scr])
  1265.             local env = newProxyEnv(scr, owner)
  1266.             serverScripts[scr][4] = env
  1267.             serverScripts[scr][5] = scr:GetFullName()
  1268.             scriptEnvs[env] = owner
  1269.             connections[env] = {}
  1270.             infoEnvs[env] = {Script = scr}
  1271.             table.insert(scripts, scr)
  1272.             setfenv(0, env)
  1273.             sendData(owner, "Output", {"Run", "Running ("..name..")"})
  1274.             if (not errorSignal.connected) then
  1275.                 errorSignal = context.Error:Connect(scriptError);
  1276.             end
  1277.             return loadstringEnabled and loadstring or Loadstring, source
  1278.         end
  1279.     end,
  1280.     __metatable = "The metatable is locked"
  1281. })
  1282.  
  1283. ------------------------------------------------------------
  1284.  
  1285. local commands, editCommands, getCommands, modCommands
  1286.  
  1287. commands = {
  1288.     ["script, do, c"] = function(player, source)
  1289.         local playerData = dataBase[player.UserId]
  1290.         local scriptObj = newScript("Script", player, "Script "..#playerData.Quicks+1, source)
  1291.         scriptObj.Parent = workspace
  1292.         table.insert(playerData.Quicks, scriptObj)
  1293.     end,
  1294.     ["local, l, x"] = function(player, source)
  1295.         local playerData = dataBase[player.UserId]
  1296.         local scriptObj = newScript("Local", player, "Local "..#playerData.Quicks+1, source)
  1297.         scriptObj.Parent = player:findFirstChildOfClass("PlayerGui")
  1298.         table.insert(playerData.Quicks, scriptObj)
  1299.     end,
  1300.     ["newlocal, nl"] = function(player, result)
  1301.         local plyrs, source = string.match(result, "(.-)/(.*)")
  1302.         if (plyrs) then
  1303.             local playerData = dataBase[player.userId]
  1304.             for i, plyr in ipairs(getPlayers(player, plyrs)) do        
  1305.                 local scriptObj = newScript("Local", player, ("Local " .. #playerData.Quicks+1 .. ": " .. plyr.Name), source)
  1306.                 scriptObj.Name = "Local"
  1307.                 scriptObj.Parent = plyr.Character
  1308.                 table.insert(playerData.Quicks, scriptObj)
  1309.             end
  1310.         end
  1311.     end,
  1312.     ["http, h"] = function(player, url)
  1313.         local source = getSource(player, "http:"..url)
  1314.         if source then
  1315.             local playerData = dataBase[player.UserId]
  1316.             local scriptObj = newScript("Script", player, "Script "..#playerData.Quicks+1, source)
  1317.             scriptObj.Parent = workspace
  1318.             table.insert(playerData.Quicks, scriptObj)
  1319.         end
  1320.     end,
  1321.     ["httplocal, httpl, hl"] = function(player, url)
  1322.         local source = getSource(player, "http:"..url)
  1323.         if source then
  1324.             local playerData = dataBase[player.UserId]
  1325.             local scriptObj = newScript("Local", player, "Local "..#playerData.Quicks+1, source)
  1326.             scriptObj.Parent = player:findFirstChildOfClass("PlayerGui")
  1327.             table.insert(playerData.Quicks, scriptObj)
  1328.         end
  1329.     end,
  1330.     ["httpnewlocal, hnl"] = function(player, result)
  1331.         local plyrs, url = string.match(result, "(.-)/(.*)")
  1332.         if (plyrs) then
  1333.             local source = getSource(player, "http:" .. url)
  1334.             if (source) then
  1335.                 local playerData = dataBase[player.userId]
  1336.                 for i, plyr in ipairs(getPlayers(player, plyrs)) do            
  1337.                     local scriptObj = newScript("Local", player, ("Local " .. #playerData.Quicks+1 .. ": " .. plyr.Name), source)
  1338.                     scriptObj.Name = "Local - " .. plyr.Name
  1339.                     scriptObj.Parent = plyr.Character
  1340.                     table.insert(playerData.Quicks, scriptObj)
  1341.                 end
  1342.             end
  1343.         end
  1344.     end,
  1345.     ["insert, i"] = function(player, id)
  1346.         if (tonumber(id)) then
  1347.             for i, child in ipairs(insert:LoadAsset(id):GetChildren()) do
  1348.                 child.Parent = player.Character
  1349.             end
  1350.         end
  1351.     end,
  1352.     ["get, g"] = function(player, result, commandBar)
  1353.         for i, msg in ipairs(splitStr(result, " ")) do
  1354.             local cmd, result = string.lower(msg):match("^([^/]+)/?(.*)")
  1355.             if (cmd) then
  1356.                 for cmdkey, func in pairs(getCommands) do
  1357.                     if ((", "..string.lower(cmdkey)..", "):match(", "..string.lower(cmd)..", ")) then
  1358.                         func(player, result, commandBar)
  1359.                     end
  1360.                 end
  1361.             end
  1362.         end
  1363.     end,
  1364.     ["sb"] = function(player, result, commandBar)
  1365.         local playerData = dataBase[player.UserId];
  1366.         if (not playerData.Mod) then
  1367.             sendData(player, "Output", {"Error", "You're not a moderator, you cannot use mod commands."});
  1368.             return;
  1369.         end
  1370.         local cmd, result = result:match("^(%w+)/(.*)")
  1371.         if (cmd) then
  1372.             for cmdkey, func in pairs(modCommands) do
  1373.                 if ((", "..string.lower(cmdkey)..", "):match(", "..string.lower(cmd)..", ")) then
  1374.                     func(player, result);
  1375.                 end
  1376.             end
  1377.         end
  1378.     end,
  1379.     ["create"] = function(player, name)
  1380.         if (string.match(name, "^[%w_]+$")) then
  1381.             local playerData = dataBase[player.userId]
  1382.             local scriptData = playerData.Scripts[name]
  1383.             disableScript(scriptData and scriptData.Script)
  1384.             playerData.Scripts[name] = {Source = ""}
  1385.             sendData(player, "Script", {{"Normal", name, toboolean(playerData.Saves[name])}})
  1386.             sendData(player, "Output", {"Note", "Created (" .. name .. ")"})
  1387.             saveScript(player, playerData.Saves, name, playerData.Scripts[name])
  1388.         else
  1389.             sendData(player, "Output", {"Error", "Name (" .. name .. ") is not allowed to use"})
  1390.         end
  1391.     end,
  1392.     ["createsource, cs"] = function(player, result)
  1393.         local name, source = string.match(result, "([^/]*)/(.+)")
  1394.         if (name and string.match(name, "^[%w_]+$")) then
  1395.             local playerData = dataBase[player.userId]
  1396.             local scriptData = playerData.Scripts[name]
  1397.             disableScript(scriptData and scriptData.Script)
  1398.             playerData.Scripts[name] = {Source = source}
  1399.             sendData(player, "Script", {{"Normal", name, toboolean(playerData.Saves[name])}})
  1400.             sendData(player, "Output", {"Note", "Created (" .. name .. ")"})
  1401.             saveScript(player, playerData.Saves, name, playerData.Scripts[name])
  1402.         else
  1403.             sendData(player, "Output", {"Error", "Name (" .. name .. ") is not allowed to use"})
  1404.         end
  1405.     end,
  1406.     ["createhttp, createh, ch"] = function(player, result)
  1407.         local name, url = string.match(result, "([^/]*)/(.*)")
  1408.         if (name and string.match(name, "^[%w_]+$")) then
  1409.             local playerData = dataBase[player.userId]
  1410.             local scriptData = playerData.Scripts[name]
  1411.             disableScript(scriptData and scriptData.Script)
  1412.             playerData.Scripts[name] = {Source = "http:" .. url}   
  1413.             sendData(player, "Script", {{"Normal", name, toboolean(playerData.Saves[name])}})
  1414.             sendData(player, "Output", {"Note", "Created (" .. name .. ")"})
  1415.             saveScript(player, playerData.Saves, name, playerData.Scripts[name])
  1416.         else
  1417.             sendData(player, "Output", {"Error", "Name (" .. (name or result) .. ") is not allowed to use"})
  1418.         end
  1419.     end,
  1420.     ["edit"] = function(player, name)
  1421.         local playerData = dataBase[player.userId]
  1422.         local scriptData = playerData.Scripts[name]
  1423.         if (scriptData) then
  1424.             playerData.Editing = {name, scriptData}
  1425.             sendData(player, "Script", {{"Edit", name, toboolean(playerData.Saves[name])}})
  1426.             sendData(player, "Output", {"Note", "Editing (" .. name .. ")"})
  1427.         else
  1428.             sendData(player, "Output", {"Error", "(" .. name .. ") doesn't exist"})
  1429.         end
  1430.     end,
  1431.     ["edithttp, edith, eh"] = function(player, result)
  1432.         local name, url = string.match(result, "([^/]*)/(.*)")
  1433.         local playerData = dataBase[player.userId]
  1434.         local scriptData = playerData.Scripts[name]
  1435.         if (scriptData) then
  1436.             scriptData.Source = "http:" .. url
  1437.             disableScript(scriptData.Script)
  1438.             sendData(player, "Script", {{"Normal", name, toboolean(playerData.Saves[name])}})
  1439.             sendData(player, "Output", {"Note", "Edited (" .. name .. ")"})
  1440.             saveScript(player, playerData.Saves, name, playerData.Scripts[name])
  1441.         else
  1442.             sendData(player, "Output", {"Error", "Name (" .. (name or result) .. ") doesn't exist / not allowed to edit"})
  1443.         end
  1444.     end,
  1445.     ["stop"] = function(player, name)
  1446.         local playerData = dataBase[player.UserId]
  1447.         local scriptData = playerData.Scripts[name]
  1448.         if (scriptData and scriptData.Script) then
  1449.             disableScript(scriptData.Script)
  1450.             scriptData.Script = nil
  1451.             sendData(player, "Script", {{"Normal", name, toboolean(playerData.Saves[name])}})
  1452.             sendData(player, "Output", {"Note", "Stopped (" .. name .. ")"})
  1453.         else
  1454.             sendData(player, "Output", {"Error", "(" .. name .. ") doesn't exist / not running"})
  1455.         end
  1456.     end,
  1457.     ["run, r"] = function(player, name)
  1458.         local playerData = dataBase[player.userId]
  1459.         local scriptData = playerData.Scripts[name]
  1460.         if (scriptData) then
  1461.             disableScript(scriptData.Script)
  1462.             local source = getSource(player, scriptData.Source)
  1463.             if (source) then
  1464.                 local scriptObj = newScript("Script", player, "Script: "..name, source)
  1465.                 scriptObj.Name = name
  1466.                 scriptObj.Parent = workspace
  1467.                 scriptData.Script = scriptObj
  1468.                 sendData(player, "Script", {{"Run", name, toboolean(playerData.Saves[name])}})
  1469.             end
  1470.         else
  1471.             sendData(player, "Output", {"Error", "(" .. name .. ") doesn't exist"})
  1472.         end
  1473.     end,
  1474.     ["runnew, rn"] = function(player, name)
  1475.         local playerData = dataBase[player.userId]
  1476.         local scriptData = playerData.Scripts[name]
  1477.         if (scriptData) then
  1478.             local source = getSource(player, scriptData.Source)
  1479.             if (source) then       
  1480.                 local scriptObj = newScript("Script", player, ("Script " .. #playerData.Quicks+1 .. " (" .. name .. ")"), source)
  1481.                 scriptObj.Name = "Script"
  1482.                 scriptObj.Parent = workspace
  1483.                 table.insert(playerData.Quicks, scriptObj)
  1484.             end
  1485.         else
  1486.             sendData(player, "Output", {"Error", "(" .. name .. ") doesn't exist"})
  1487.         end
  1488.     end,
  1489.     ["runlocal, runl, rl"] = function(player, name)
  1490.         local playerData = dataBase[player.userId]
  1491.         local scriptData = playerData.Scripts[name]
  1492.         if (scriptData) then
  1493.             disableScript(scriptData.Script)
  1494.             local source = getSource(player, scriptData.Source)
  1495.             if (source) then
  1496.                 local scriptObj = newScript("Local", player, "Local: "..name, source)
  1497.                 scriptObj.Name = name
  1498.                 scriptObj.Parent = player.Character
  1499.                
  1500.                 scriptData.Script = scriptObj
  1501.                 sendData(player, "Script", {{"Run", name, toboolean(playerData.Saves[name])}})
  1502.             end
  1503.         else
  1504.             sendData(player, "Output", {"Error", "(" .. name .. ") doesn't exist"})
  1505.         end
  1506.     end,
  1507.     ["runlocalto, rlt"] = function(player, result)
  1508.         local plyrs, name = string.match(result, "(.-)/(.*)")
  1509.         local playerData = dataBase[player.userId]
  1510.         local scriptData = playerData.Scripts[name]
  1511.         if (scriptData) then
  1512.             local source = getSource(player, scriptData.Source)
  1513.             if (source) then
  1514.                 for i, plyr in ipairs(getPlayers(player, plyrs)) do                
  1515.                     local scriptObj = newScript("Local", player, ("Local (" .. name .. "): " .. plyr.Name), source)
  1516.                     scriptObj.Name = name
  1517.                     scriptObj.Parent = plyr.Character
  1518.                     table.insert(playerData.Quicks, scriptObj)
  1519.                 end
  1520.             end
  1521.         else
  1522.             sendData(player, "Output", {"Error", "(" .. (name or "") .. ") doesn't exist"})
  1523.         end
  1524.     end,
  1525.     ["save"] = function(player, name)
  1526.         local playerData = dataBase[player.userId]
  1527.         local scriptData = playerData.Scripts[name]
  1528.         if (scriptData and not scriptData.Shared) then
  1529.             saveScript(player, playerData.Saves, name, scriptData, true)
  1530.             sendData(player, "Script", {{(scriptData.Script and "Run" or "Normal"), name, true}})
  1531.         else
  1532.             sendData(player, "Output", {"Error", "(" .. name .. ") doesn't exist / not allowed to save"})
  1533.         end
  1534.     end,
  1535.     ["unsave"] = function(player, name)
  1536.         local playerData = dataBase[player.userId]
  1537.         local scriptData = playerData.Scripts[name]
  1538.         if (scriptData and playerData.Saves[name]) then
  1539.             saveScript(player, playerData.Saves, name, nil)
  1540.             sendData(player, "Script", {{(scriptData.Script and "Run" or "Normal"), name}})
  1541.         else
  1542.             sendData(player, "Output", {"Error", "(" .. name .. ") doesn't exist / not saved"})
  1543.         end
  1544.     end,
  1545.     ["rename"] = function(player, result)
  1546.         local name, newName = string.match(result, "([^/]*)/(.*)")
  1547.         local playerData = dataBase[player.userId]
  1548.         local scripts = playerData.Scripts
  1549.         if (name and string.match(newName, "^[%w_]+$") and not scripts[newName]) then
  1550.             local scriptData = scripts[name]
  1551.             if (scriptData) then
  1552.                 local isSaved = toboolean(playerData.Saves[name])
  1553.                 scripts[name] = nil
  1554.                 scripts[newName] = scriptData
  1555.                
  1556.                 if (isSaved) then
  1557.                     saveScript(player, playerData.Saves, name, nil)
  1558.                 end
  1559.                 sendData(player, "RemoveScript", {name})
  1560.                 sendData(player, "Script", {{(scriptData.Script and "Run" or "Normal"), newName, isSaved}})
  1561.                 sendData(player, "Output", {"Note", "Renamed (" .. name .. ") to (" .. newName .. ")"})
  1562.                
  1563.                 saveScript(player, playerData.Saves, newName, scriptData, isSaved)
  1564.             else
  1565.                 sendData(player, "Output", {"Error", "(" .. name .. ") doesn't exist"})
  1566.             end
  1567.         else
  1568.             sendData(player, "Output", {"Error", "(" .. (newName or result) .. ") doesn't exist / not allowed to use"})
  1569.         end
  1570.     end,
  1571.     ["remove"] = function(player, name)
  1572.         local playerData = dataBase[player.userId]
  1573.         local scripts = playerData.Scripts
  1574.         if (name == "-all") then
  1575.             local removed = {}
  1576.             for name, scriptData in pairs(scripts) do
  1577.                 disableScript(scriptData.Script)
  1578.                 scripts[name] = nil
  1579.                 saveScript(player, playerData.Saves, name, nil)
  1580.                 table.insert(removed, name)
  1581.             end
  1582.             sendData(player, "RemoveScript", removed)
  1583.             sendData(player, "Output", {"Note", "Removed all scripts"})
  1584.         elseif (name == "-shared") then
  1585.             local removed = {}
  1586.             for name, scriptData in pairs(scripts) do
  1587.                 if (scriptData.Shared) then
  1588.                     disableScript(scriptData.Script)
  1589.                     scripts[name] = nil
  1590.                     saveScript(player, playerData.Saves, name, nil)
  1591.                     table.insert(removed, name)
  1592.                 end
  1593.             end
  1594.             sendData(player, "RemoveScript", removed)
  1595.             sendData(player, "Output", {"Note", "Removed shared scripts"})         
  1596.         else
  1597.             local scriptData = playerData.Scripts[name]
  1598.             if (scriptData) then
  1599.                 disableScript(scriptData.Script)
  1600.                 scripts[name] = nil
  1601.                 saveScript(player, playerData.Saves, name, nil)
  1602.                 sendData(player, "RemoveScript", {name})
  1603.                 sendData(player, "Output", {"Note", "Removed (" .. name .. ")"})
  1604.             else
  1605.                 sendData(player, "Output", {"Error", "(" .. name .. ") doesn't exist"})
  1606.             end
  1607.         end
  1608.     end,
  1609.     ["share"] = function(player, result)
  1610.         local plyrs, name = string.match(result, "(.-)/(.*)")
  1611.         local playerData = dataBase[player.userId]
  1612.         local scriptData = playerData.Scripts[name]
  1613.         if (scriptData and not scriptData.Shared) then
  1614.             for i, plyr in ipairs(getPlayers(player, plyrs)) do
  1615.                 if (plyr ~= player) then
  1616.                     local plyrData = dataBase[plyr.userId]
  1617.                     local scripts = plyrData.Scripts
  1618.                     local sharedName = name
  1619.                     while scripts[sharedName] do
  1620.                         sharedName = sharedName:gsub("%d+$", "") .. (tonumber(string.match(sharedName, "(%d+)$")) or 0) + 1
  1621.                     end
  1622.                     scripts[sharedName] = {Source = scriptData.Source, Shared = true}
  1623.                     sendData(plyr, "Script", {{"Normal", sharedName}})
  1624.                     sendData(plyr, "Output", {"Note", player.Name .. " shared (" .. sharedName .. ")"})
  1625.                     sendData(player, "Output", {"Note", "Shared (" .. name .. ") to " .. plyr.Name})
  1626.                 end
  1627.             end
  1628.         else
  1629.             sendData(player, "Output", {"Error", "(" .. (name or "") .. ") doesn't exist / not allowed to share"})
  1630.         end
  1631.     end
  1632. }
  1633.  
  1634. editCommands = {
  1635.     default = function(player, source)
  1636.         local playerData = dataBase[player.userId]
  1637.         local name, scriptData = unpack(playerData.Editing)
  1638.         scriptData.Source = scriptData.Source .. (scriptData.Source ~= "" and "\n" or "") .. source
  1639.         sendData(player, "Output", {"Note", "Text Appended"})
  1640.     end,
  1641.     exit = function(player)
  1642.         local playerData = dataBase[player.userId]
  1643.         local name, scriptData = unpack(playerData.Editing)
  1644.         playerData.Editing = nil
  1645.         disableScript(scriptData.Script)
  1646.         saveScript(player, playerData.Saves, name, scriptData)
  1647.         sendData(player, "Script", {{"Normal", name, toboolean(playerData.Saves[name])}})  
  1648.         sendData(player, "Output", {"Note", "Exited (" .. name .. ")"})
  1649.     end,
  1650.     clear = function(player)
  1651.         local playerData = dataBase[player.userId]
  1652.         local name, scriptData = unpack(playerData.Editing)
  1653.         scriptData.Source = ""
  1654.         sendData(player, "Output", {"Note", "Source cleared"})
  1655.     end
  1656. }
  1657.  
  1658. getCommands = {
  1659.     ["reset, respawn, r"] = function(player)
  1660.         player:LoadCharacter()
  1661.         sendData(player, "Output", {"Note", "Got reset"})
  1662.     end,
  1663.     ["clean, c"] = function(player, type)
  1664.         if type == "all" then
  1665.             if dataBase[player.userId].Mod then
  1666.                 for _, playerData in pairs(dataBase) do
  1667.                     local plyr = playerData.Player
  1668.                     local quicks = playerData.Quicks
  1669.                     local scripts = playerData.Scripts
  1670.                     local stopped = {}
  1671.                     for i, scriptObj in pairs(quicks) do
  1672.                         if (scriptObj:IsA("Script")) then
  1673.                             disableScript(scriptObj)
  1674.                             quicks[i] = nil
  1675.                         end
  1676.                     end
  1677.                     for name, scriptData in pairs(scripts) do
  1678.                         local scriptObj = scriptData.Script
  1679.                         if (scriptObj and scriptObj:IsA("Script")) then
  1680.                             disableScript(scriptObj)
  1681.                             scriptData.Script = nil
  1682.                             table.insert(stopped, {"Normal", name, toboolean(playerData.Saves[name])})
  1683.                         end
  1684.                     end
  1685.                     sendData(plyr, "Script", stopped)
  1686.                     sendData(plyr, "Output", {"Note", "Got no scripts all (command from " .. player.Name .. ")"});
  1687.                     sendData(plyr, "Output", {"Note", "Got no localscripts all (command from " .. player.Name .. ")"});
  1688.                 end
  1689.                 return
  1690.             else
  1691.                 sendData(player, "Output", {"Error", "Only scripts role above or mods can use clean/all"})
  1692.             end
  1693.         end
  1694.         local function clean(obj, ignoreList)
  1695.             if not obj then return end
  1696.             for i, child in pairs(obj:GetChildren()) do
  1697.                 if not (serverScripts[child] or players:GetPlayerFromCharacter(child)) then
  1698.                     if not table.find(ignoreList, child) then
  1699.                         child:Destroy()
  1700.                     end
  1701.                 end
  1702.             end
  1703.         end
  1704.         clean(workspace, {terrain, workspace.CurrentCamera, mainParts.Base})
  1705.         clean(mainParts.Base, {mainParts.Walls})
  1706.         terrain:ClearAllChildren()
  1707.         insert:ClearAllChildren()
  1708.         sendData(player, "Output", {"Note", "Got clean"})
  1709.     end,
  1710.     ["clearterrain, cleart, cleant, ct"] = function(player)
  1711.         terrain:Clear()
  1712.         sendData(player, "Output", {"Note", "Got clean terrain"})
  1713.     end,
  1714.     ["base, b"] = function(player)
  1715.         if mainParts.Base then
  1716.             mainParts.Base:Destroy()
  1717.         end
  1718.         local base = Instance.new("Part")
  1719.         coroutine.wrap(function()
  1720.             local destroyed = false
  1721.             base.Changed:Connect(function(prop)
  1722.                 if prop == "Parent" then
  1723.                     if isDestroyed(base) then
  1724.                         destroyed = true
  1725.                     end
  1726.                 end
  1727.             end)
  1728.             while not destroyed do
  1729.                 base.Name = "Base"
  1730.                 base.Locked = true
  1731.                 base.Anchored = true
  1732.                 base.formFactor = "Custom"
  1733.                 base.Material = "Grass"
  1734.                 base.TopSurface = "Smooth"
  1735.                 base.BottomSurface = "Smooth"
  1736.                 base.Color = Color3.fromRGB(30, 128, 29)
  1737.                 base.Size = Vector3.new(700, 1.2, 700)
  1738.                 base.CFrame = CFrame.new(0, -0.6, 0)
  1739.                 wait()
  1740.             end
  1741.         end)()
  1742.         mainParts.Base = base
  1743.         base.Parent = workspace
  1744.         sendData(player, "Output", {"Note", "Got base"})
  1745.     end,
  1746.     ["nobase, nb"] = function(player)
  1747.         if mainParts.Base then
  1748.             mainParts.Base:Destroy()
  1749.         end
  1750.         sendData(player, "Output", {"Note", "Got no base"})
  1751.     end,
  1752.     ["walls, wall, wl, w"] = function(player)
  1753.         if (mainParts.Walls) then
  1754.             mainParts.Walls:Destroy()
  1755.         end
  1756.         local walls = Instance.new("Model")
  1757.         if not (mainParts.Base and mainParts.Base.Parent) then
  1758.             return sendData(player, "Output", {"Error", "Unable to create walls"})
  1759.         end
  1760.         local wall1 = mainParts.Base:Clone()
  1761.         wall1:ClearAllChildren()
  1762.         wall1.Name = "Wall"
  1763.         wall1.Anchored = true
  1764.         wall1.Locked = true
  1765.         wall1.Size = Vector3.new(700, 150, 0)
  1766.         wall1.CFrame = CFrame.new(0, 150/2-1.2, 350)
  1767.         wall1.Parent = walls
  1768.         local wall2 = wall1:Clone()
  1769.         wall2.Size = Vector3.new(700, 150, 0)
  1770.         wall2.CFrame = CFrame.new(0, 150/2-1.2, -350)
  1771.         wall2.Parent = walls
  1772.         local wall3 = wall1:Clone()
  1773.         wall3.Size = Vector3.new(0, 150, 700)
  1774.         wall3.CFrame = CFrame.new(350, 150/2-1.2, 0)
  1775.         wall3.Parent = walls
  1776.         local wall4 = wall1:Clone()
  1777.         wall4.Size = Vector3.new(0, 150, 700)
  1778.         wall4.CFrame = CFrame.new(-350, 150/2-1.2, 0)
  1779.         wall4.Parent = walls
  1780.         walls.Parent = mainParts.Base
  1781.         mainParts.Walls = walls
  1782.         sendData(player, "Output", {"Note", "Got walls"})
  1783.     end,
  1784.     ["nowalls, nowall, nwl, nw"] = function(player)
  1785.         if mainParts.Walls then
  1786.             mainParts.Walls:Destroy()
  1787.         end
  1788.         sendData(player, "Output", {"Note", "Got no wall"})
  1789.     end,
  1790.     ["debug, db"] = function(player)
  1791.         if not player:findFirstChild("PlayerGui") and player:findFirstChildOfClass("PlayerGui") then
  1792.             player:findFirstChildOfClass("PlayerGui").Name = "PlayerGui"
  1793.         end
  1794.         local function debug(obj)
  1795.             for i, child in pairs(obj:GetChildren()) do
  1796.                 if child:IsA("Hint") or child:IsA("Message") then
  1797.                     child:Destroy()
  1798.                 end
  1799.                 debug(child)
  1800.             end
  1801.         end
  1802.         debug(workspace)
  1803.         local scriptObj = CreateLocal([[
  1804.         local function debug(obj,rec)
  1805.             for i,child in ipairs(obj:GetChildren()) do
  1806.                 if child:IsA("Hint") or child:IsA("Message") then
  1807.                     child:Destroy()
  1808.                 end
  1809.                 if rec then
  1810.                     debug(child)
  1811.                 end
  1812.             end
  1813.         end
  1814.         debug(workspace,true)
  1815.         debug(script.Parent)
  1816.         wait();script:Destroy()]])
  1817.         scriptObj.Name = "Debug"
  1818.         scriptObj.Parent = player:WaitForChild("PlayerGui")
  1819.         sendData(player, "Output", {"Note", "Got debug"})
  1820.     end,
  1821.     ["sreset, posrespawn, sr"] = function(player)
  1822.         local torso = player.Character and player.Character:findFirstChild("HumanoidRootPart") or nil
  1823.         if torso then
  1824.             local lastCF = torso.CFrame
  1825.             player:LoadCharacter()
  1826.             local char = player.Character or player.CharacterAdded:Wait()
  1827.             char:findFirstChild("HumanoidRootPart").CFrame = lastCF
  1828.         else
  1829.             player:LoadCharacter()
  1830.         end
  1831.         sendData(player, "Output", {"Note", "Got position reset"})
  1832.     end,
  1833.     ["dummy, dum, d"] = function(player)
  1834.         local dum = DefDummy:Clone()
  1835.         local char = player.Character
  1836.         dum.Parent = workspace
  1837.         dum:MakeJoints()
  1838.         if char then
  1839.             local root = char:findFirstChild("HumanoidRootPart")
  1840.             if root then
  1841.                 dum:MoveTo(root.Position)
  1842.             end
  1843.         end
  1844.         sendData(player, "Output", {"Note", "Got dummy"})
  1845.     end,
  1846.     ["noquicks, noquick, noq, nq"] = function(player)
  1847.         local quicks = dataBase[player.userId].Quicks
  1848.         for i, scriptObj in pairs(quicks) do
  1849.             disableScript(scriptObj)
  1850.             quicks[i] = nil
  1851.         end
  1852.         sendData(player, "Output", {"Note", "Got no quicks"})
  1853.     end,
  1854.     ["noscripts, nos, ns"] = function(player, type)
  1855.         for _, playerData in pairs(type == "all" and dataBase or {dataBase[player.userId]}) do
  1856.             local plyr = playerData.Player
  1857.             local quicks = playerData.Quicks
  1858.             local scripts = playerData.Scripts
  1859.             local stopped = {}
  1860.             for i, scriptObj in pairs(quicks) do
  1861.                 if (scriptObj.ClassName == "Script") then
  1862.                     disableScript(scriptObj)
  1863.                     quicks[i] = nil
  1864.                 end
  1865.             end
  1866.             for name, scriptData in pairs(scripts) do
  1867.                 local scriptObj = scriptData.Script
  1868.                 if (scriptObj and scriptObj.ClassName == "Script") then
  1869.                     disableScript(scriptObj)
  1870.                     scriptData.Script = nil
  1871.                     table.insert(stopped, {"Normal", name, toboolean(playerData.Saves[name])})
  1872.                 end
  1873.             end
  1874.             sendData(plyr, "Script", stopped)
  1875.             if (type == "all") then
  1876.                 sendData(plyr, "Output", {"Note", "Got no scripts all (command from " .. player.Name .. ")"});
  1877.             else
  1878.                 sendData(plyr, "Output", {"Note", "Got no scripts"});
  1879.             end
  1880.         end
  1881.     end,
  1882.     ["nolocal, nol, nl"] = function(player, type)
  1883.         for i, playerData in pairs(type == "all" and dataBase or {dataBase[player.userId]}) do
  1884.             local plyr = playerData.Player
  1885.             local quicks = playerData.Quicks
  1886.             local scripts = playerData.Scripts
  1887.             local stopped = {}
  1888.             local disable = Instance.new("StringValue")
  1889.             disable.Name = "DS"
  1890.             disable.Value = plyr.Name
  1891.             disable.Parent = replicated
  1892.             for i, scriptObj in pairs(quicks) do
  1893.                 if (scriptObj.ClassName == "LocalScript") then
  1894.                     disableScript(scriptObj)
  1895.                     quicks[i] = nil
  1896.                 end
  1897.             end
  1898.             for name, scriptData in pairs(scripts) do
  1899.                 local scriptObj = scriptData.Script
  1900.                 if (scriptObj and scriptObj.ClassName == "LocalScript") then
  1901.                     disableScript(scriptObj)
  1902.                     scriptData.Script = nil
  1903.                     table.insert(stopped, {"Normal", name, toboolean(playerData.Saves[name])})
  1904.                 end
  1905.             end
  1906.             sendData(plyr, "Script", stopped)
  1907.             if (type == "all") then
  1908.                 sendData(plyr, "Output", {"Note", "Got no localscripts all (command from " .. player.Name .. ")"});
  1909.             else
  1910.                 sendData(plyr, "Output", {"Note", "Got no localscripts"});
  1911.             end
  1912.         end
  1913.     end,
  1914.     ["rejoin, rj"] = function(player)
  1915.         local userId = player.UserId
  1916.         local succeeded, errorMsg, placeId, instanceId = teleport:GetPlayerPlaceInstanceAsync(userId)
  1917.         if succeeded then
  1918.             teleport:TeleportToPlaceInstance(placeId, instanceId, player)
  1919.         else
  1920.             sendData(player, "Output", {"Error", "Unable to rejoin"})
  1921.         end
  1922.     end,
  1923.     ["fly"] = function(player)
  1924.         local tool = Instance.new("Tool")
  1925.         tool.Name = "Fly"
  1926.         tool.CanBeDropped = false
  1927.         tool.RequiresHandle = false
  1928.         CreateLocal([[
  1929.         local bin = script.Parent
  1930.         local player = game:GetService("Players").LocalPlayer
  1931.         local mouse = player:GetMouse()
  1932.         local char = player.Character
  1933.         local torso = char:FindFirstChild("HumanoidRootPart")
  1934.         local seleted = false
  1935.         local pos, gyro;
  1936.  
  1937.         bin.Equipped:Connect(function()
  1938.             selected = true
  1939.             pos = Instance.new("BodyPosition", torso)
  1940.             pos.maxForce = Vector3.new(1,1,1) * 1e99
  1941.             pos.position = torso.Position
  1942.             gyro = Instance.new("BodyGyro", torso)
  1943.             gyro.maxTorque = Vector3.new(1,1,1) * 1e99
  1944.             local angle = CFrame.new()
  1945.             mouse.Button1Down:Connect(function()
  1946.                 local button_up = false
  1947.                 angle = CFrame.Angles(-math.rad(70),0,0)
  1948.                 coroutine.resume(coroutine.create(function()
  1949.                     while not button_up do
  1950.                         pos.position = pos.position + (mouse.Hit.p - torso.Position).unit * 10
  1951.                         wait()
  1952.                     end
  1953.                 end))
  1954.                 mouse.Button1Up:Wait()
  1955.                 button_up = true
  1956.                 angle = CFrame.new()
  1957.             end)
  1958.             while selected do
  1959.                 gyro.cframe = CFrame.new(torso.Position, mouse.Hit.p) * angle
  1960.                 wait()
  1961.             end
  1962.         end)
  1963.  
  1964.         bin.Unequipped:Connect(function()
  1965.             selected = false
  1966.             pos:Destroy()
  1967.             gyro:Destroy()
  1968.         end)
  1969.         ]], tool).Name = "script"
  1970.         tool.Parent = player:findFirstChildOfClass("Backpack")
  1971.         sendData(player, "Output", {"Note", "Got fly"})
  1972.     end,
  1973.     ["ball, bl"] = function(player)
  1974.         local tool = Instance.new("Tool")
  1975.         tool.Name = "Ball"
  1976.         tool.CanBeDropped = false
  1977.         tool.RequiresHandle = false
  1978.         local ss = CreateScript([[local player = script.Parent.Parent.Parent
  1979.         if not player or not player:IsA("Player") then return end
  1980.         local cl = script:WaitForChild("script")
  1981.         local torso = player.Character:WaitForChild("HumanoidRootPart")
  1982.         local ball = Instance.new("Part")
  1983.         ball.Name = "ball"
  1984.         ball.Shape = "Ball"
  1985.         ball.Locked = true
  1986.         ball.Size = Vector3.new(10,10,10)
  1987.         ball.BrickColor = torso.BrickColor
  1988.         ball.Transparency = 0.5
  1989.         ball.TopSurface = "Smooth"
  1990.         ball.BottomSurface = "Smooth"
  1991.         ball.CFrame = torso.CFrame
  1992.         local weld = Instance.new("Weld",ball)
  1993.         weld.Part0 = torso
  1994.         weld.Part1 = ball
  1995.         weld.C0 = CFrame.new(0,1.75,0)
  1996.         ball.Parent = cl
  1997.         ]], tool)
  1998.         ss.Name = "script"
  1999.         local cs = CreateLocal([[local speed = math.rad(135)
  2000.         local bin = script.Parent.Parent
  2001.         local player = game:GetService("Players").LocalPlayer
  2002.         local mouse = player:GetMouse()
  2003.         local cam = workspace.CurrentCamera
  2004.         local char = player.Character
  2005.         local hum = char:WaitForChild("Humanoid")
  2006.         local torso = char:WaitForChild("HumanoidRootPart")
  2007.         local ball = script:WaitForChild("ball")
  2008.         local mConn
  2009.        
  2010.         local function newThread(func)
  2011.             coroutine.resume(coroutine.create(func))
  2012.         end
  2013.  
  2014.         bin.Equipped:Connect(function()
  2015.             hum.PlatformStand = true
  2016.             mConn = mouse.KeyDown:Connect(function(key)
  2017.                 if key == "w" then
  2018.                     local keyUp = false
  2019.                     newThread(function()
  2020.                         repeat until mouse.KeyUp:wait() == "w"
  2021.                         keyUp = true
  2022.                     end)
  2023.                     while hum.PlatformStand and not keyUp and wait(1/60) do
  2024.                         local lv = cam.CoordinateFrame.lookVector
  2025.                         torso.RotVelocity = torso.RotVelocity + Vector3.new(lv.z,0,-lv.x) * speed
  2026.                     end
  2027.                 elseif key == "s" then
  2028.                     local keyUp = false
  2029.                     newThread(function()
  2030.                         repeat until mouse.KeyUp:wait() == "s"
  2031.                         keyUp = true
  2032.                     end)
  2033.                     while hum.PlatformStand and not keyUp and wait(1/60) do
  2034.                         local lv = cam.CoordinateFrame.lookVector
  2035.                         torso.RotVelocity = torso.RotVelocity + Vector3.new(-lv.z,0,lv.x) * speed
  2036.                     end
  2037.                 elseif key == "a" then
  2038.                     local keyUp = false
  2039.                     newThread(function()
  2040.                         repeat until mouse.KeyUp:wait() == "a"
  2041.                         keyUp = true
  2042.                     end)
  2043.                     while hum.PlatformStand and not keyUp and wait(1/60) do
  2044.                         local lv = cam.CoordinateFrame.lookVector
  2045.                         local dir = math.atan2(lv.z,-lv.x) + math.rad(90)
  2046.                         torso.RotVelocity = torso.RotVelocity + Vector3.new(math.sin(dir),0,math.cos(dir)) * speed          
  2047.                     end
  2048.                 elseif key == "d" then
  2049.                     local keyUp = false
  2050.                     newThread(function()
  2051.                         repeat until mouse.KeyUp:wait() == "d"
  2052.                         keyUp = true
  2053.                     end)
  2054.                     while hum.PlatformStand and not keyUp and wait(1/60) do
  2055.                         local lv = cam.CoordinateFrame.lookVector
  2056.                         local dir = math.atan2(lv.z,-lv.x) - math.rad(90)
  2057.                         torso.RotVelocity = torso.RotVelocity + Vector3.new(math.sin(dir),0,math.cos(dir)) * speed  
  2058.                     end
  2059.                 elseif key == " " then
  2060.                     if math.abs(ball.Velocity.y) <= 10 then
  2061.                         hum.PlatformStand = true
  2062.                         ball.Velocity = torso.Velocity + Vector3.new(0,75,0)
  2063.                     end
  2064.                 end
  2065.             end)
  2066.         end)
  2067.  
  2068.         bin.Unequipped:Connect(function()
  2069.             hum.PlatformStand = false
  2070.             if mConn then
  2071.                 mConn:Disconnect()
  2072.             end
  2073.         end)]], ss)
  2074.         cs.Name = "script"
  2075.         tool.Parent = player:findFirstChildOfClass("Backpack")
  2076.         sendData(player, "Output", {"Note", "Got ball"})
  2077.     end,
  2078.     ["nil"] = function(player)
  2079.         player.Character = nil
  2080.         sendData(player, "Output", {"Note", "Got nil"})
  2081.     end,
  2082.     ["nonils, nonil, nn"] = function(player)
  2083.         local crash = Instance.new("RemoteFunction", replicated)
  2084.         for i, net in pairs(network:GetChildren()) do
  2085.             local plyr = net:GetPlayer()
  2086.             if plyr.Parent == nil then
  2087.                 crash:InvokeClient(plyr, ("crash"):rep(2e5))
  2088.             end
  2089.         end
  2090.         crash:Destroy()
  2091.         sendData(player, "Output", {"Note", "Got no nil players"})
  2092.     end,
  2093.     ["forcefield, ff"] = function(player)
  2094.         Instance.new("ForceField", player.Character)
  2095.         sendData(player, "Output", {"Note", "Got ForceField"})
  2096.     end,
  2097.     ["noforcefield, noff, unff"] = function(player)
  2098.         for _, child in pairs(player.Character and player.Character:GetChildren() or {}) do
  2099.             if child:IsA("ForceField") then
  2100.                 child:Destroy()
  2101.             end
  2102.         end
  2103.         sendData(player, "Output", {"Note", "Got no ForceField"})
  2104.     end,
  2105.     ["notools, not, nt"] = function(player)
  2106.         local backpack = player:findFirstChildOfClass("Backpack")
  2107.         if backpack then
  2108.             for _, tool in pairs(backpack:GetChildren()) do
  2109.                 tool:Destroy()
  2110.             end
  2111.         end
  2112.         sendData(player, "Output", {"Note", "Got no tools"})
  2113.     end,
  2114.     ["noguis, nog, ng"] = function(player)
  2115.         if player:findFirstChildOfClass("PlayerGui") then
  2116.             for _, gui in pairs(player:findFirstChildOfClass("PlayerGui"):GetChildren()) do
  2117.                 gui:Destroy()
  2118.             end
  2119.         end
  2120.         sendData(player, "Output", {"Note", "Got no guis"})
  2121.     end,
  2122.     ["nosky"] = function(player)
  2123.         lighting:ClearAllChildren()
  2124.         sendData(player, "Output", {"Note", "Got no sky"})
  2125.     end,
  2126.     ["fixlighting, fixl, fl"] = function(player)
  2127.         lighting.Ambient = Color3.fromRGB(0, 0, 0)
  2128.         lighting.Brightness = 1
  2129.         lighting.ColorShift_Bottom = Color3.fromRGB(0, 0, 0)
  2130.         lighting.ColorShift_Top = Color3.fromRGB(0, 0, 0)
  2131.         lighting.FogColor = Color3.fromRGB(192, 192, 192)
  2132.         lighting.FogEnd = 100000
  2133.         lighting.FogStart = 0
  2134.         lighting.GeographicLatitude = 41.73
  2135.         lighting.GlobalShadows = true
  2136.         lighting.OutdoorAmbient = Color3.fromRGB(127, 127, 127)
  2137.         lighting.Outlines = false
  2138.         lighting.ShadowColor = Color3.fromRGB(178, 178, 178)
  2139.         lighting.TimeOfDay = "17:00:00"
  2140.         sendData(player, "Output", {"Note", "Got lighting fix"})
  2141.     end,
  2142.     ["fixcharacter, fixchar"] = function(player)
  2143.         player.CharacterAppearance = "http://www.roblox.com/Asset/CharacterFetch.ashx?userId=" .. tostring(player.userId) .. "&placeId=" .. game.PlaceId
  2144.         player:LoadCharacter()
  2145.         sendData(player, "Output", {"Note", "Got character fix"})
  2146.     end,
  2147.     ["fixcamera, fixcam, fixc, fc"] = function(player)
  2148.         local scriptObj = CreateLocal([[
  2149.         local player = game:GetService("Players").LocalPlayer
  2150.         if workspace.CurrentCamera then
  2151.             workspace.CurrentCamera:Destroy()
  2152.         end
  2153.         local camera = Instance.new("Camera",workspace)
  2154.         if player.Character then
  2155.             local hum = player.Character:findFirstChildOfClass("Humanoid")
  2156.             if hum then
  2157.                 camera.CameraSubject = hum
  2158.             end
  2159.         end
  2160.         camera.CameraType = "Custom"
  2161.  
  2162.         workspace.CurrentCamera = camera
  2163.         wait(); script:Destroy()]])
  2164.         scriptObj.Name = "CameraFix"
  2165.         scriptObj.Parent = player:WaitForChild("PlayerGui")
  2166.         sendData(player, "Output", {"Note", "Got camera fix"})
  2167.     end,
  2168.     ["ps, pri"] = function(player, key)
  2169.         if type(PrivateServers) ~= "table" then
  2170.             mainData:SetAsync(psKey, {})
  2171.         end
  2172.         PrivateServers = mainData:GetAsync(psKey) or {}
  2173.         local code = PrivateServers[key] or (function()
  2174.             sendData(player, "Output", {"Warn", "Server does not exist, creating..."})
  2175.             local newCode = teleport:ReserveServer(game.PlaceId)
  2176.             PrivateServers[key] = newCode
  2177.             mainData:UpdateAsync(psKey, function(tab)
  2178.                 local newTab = type(tab) == "table" and tab or {}
  2179.                 newTab[key] = newCode
  2180.                 return newTab
  2181.             end)
  2182.             sendData(player, "Output", {"Warn", "Server created"})
  2183.             return newCode
  2184.         end)()
  2185.         sendData(player, "Output", {"Note", "Teleporting to private server"})
  2186.         teleport:TeleportToPrivateServer(game.PlaceId, code, {player})
  2187.     end,
  2188.     ["buildtools, btools, f3x, bt"] = function(player)
  2189.         local backpack = player:findFirstChildOfClass("Backpack")
  2190.         if backpack then
  2191.             btools:Clone().Parent = backpack
  2192.         end
  2193.         sendData(player, "Output", {"Note", "Got building tools"})
  2194.     end,
  2195.     ["nosounds, nosound"] = function(player)
  2196.         for _, child in pairs(game:GetDescendants()) do
  2197.             pcall(function()
  2198.                 if child:IsA("Sound") then
  2199.                     child:Destroy()
  2200.                 end
  2201.             end)
  2202.         end
  2203.         sendData(player, "Output", {"Note", "Got no sounds"})
  2204.     end,
  2205.     ["teleport, tp"] = function(player, plyrs)
  2206.         local plyr = getPlayers(player, plyrs)[1]
  2207.         local char1 = player.Character
  2208.         local char2 = plyr and plyr.Character or nil
  2209.         if char1 and char1:IsA("Model") and char2 and char2:IsA("Model") then
  2210.             char1:MoveTo(char2:GetPrimaryPartCFrame().p)
  2211.             sendData(player, "Output", {"Note", "Got teleport to "..plyr.Name})
  2212.         else
  2213.             sendData(player, "Output", {"Error", "Unable to teleport"})
  2214.         end
  2215.     end,
  2216.     ["walkspeed, speed, ws"] = function(player, speed)
  2217.         local hum = player.Character and player.Character:findFirstChildOfClass("Humanoid") or nil
  2218.         local speed = tonumber(speed) or 16
  2219.         if hum then
  2220.             hum.WalkSpeed = speed
  2221.             sendData(player, "Output", {"Note", "Got WalkSpeed set to "..speed})
  2222.         else
  2223.             sendData(player, "Output", {"Error", "Unable to set WalkSpeed"})
  2224.         end
  2225.     end,
  2226.     ["noteams"] = function(player)
  2227.         for i, v in pairs(players:GetPlayers()) do
  2228.             v.Neutral = true
  2229.         end
  2230.         game:GetService("Teams"):ClearAllChildren()
  2231.         sendData(player, "Output", {"Note", "Got no teams"})
  2232.     end,
  2233.     ["noleaderboard, nolb"] = function(player)
  2234.         for i, plyr in pairs(players:GetPlayers()) do
  2235.             if plyr:findFirstChild("leaderstats") then
  2236.                 plyr.leaderstats:Destroy()
  2237.             end
  2238.         end
  2239.         sendData(player, "Output", {"Note", "Got no leaderboards"})
  2240.     end,
  2241.     ["cmd, cmds, help"] = function(player)
  2242.         local playerData = dataBase[player.userId]
  2243.         local r = game:GetService("RunService").Stepped
  2244.         local isMod = playerData.Mod
  2245.         for cmd in pairs(commands) do
  2246.             sendData(player, "Output", {"Print", cmd.."/"})
  2247.         end
  2248.         for cmd in pairs(getCommands) do
  2249.             sendData(player, "Output", {"Print", "get/"..cmd})
  2250.         end
  2251.         sendData(player, "Output", {isMod and "Note" or "Error", "Mod commands"})
  2252.         r:wait()
  2253.         for cmd in pairs(modCommands) do
  2254.             sendData(player, "Output", {"Print", "sb/"..cmd})
  2255.         end
  2256.         sendData(player, "Output", {"Note", "Got commands"})
  2257.     end,
  2258.     ["banneds, banned"] = function(player)
  2259.         if next(banList) then
  2260.             sendData(player, "Output", {"Print", "==== Server Banneds ===="})
  2261.         end
  2262.         for userId, data in pairs(banList) do
  2263.             local name, bannedBy, reason = data.Name, data.BannedBy, data.Reason;
  2264.             sendData(player, "Output", {"Print", name.." - Banned by: "..bannedBy.." - Reason: "..reason});
  2265.         end
  2266.         wait()
  2267.         if next(gBanList) then
  2268.             sendData(player, "Output", {"Print", "==== Game Banneds ===="})
  2269.         end
  2270.         for userId, data in pairs(gBanList) do
  2271.             local name, bannedBy, reason, timestamp, duration = data.Name, data.BannedBy, data.Reason, data.Timestamp, data.Duration;
  2272.             local timeLeftInDays = duration-math.floor((os.time()-timestamp)/86400);
  2273.             if (timeLeftInDays <= 0) then
  2274.                 RemoveGlobalBan(userId)
  2275.             else
  2276.                 sendData(player, "Output", {"Print", name.." - Banned by: "..bannedBy.." - Days left: "..timeLeftInDays.." - Reason: "..reason});
  2277.             end
  2278.             wait()
  2279.         end
  2280.         sendData(player, "Output", {"Note", "Got banned list"})
  2281.     end,
  2282.     ["network, net"] = function(player)
  2283.         for i, net in ipairs(network:GetChildren()) do
  2284.             local plyr = net:GetPlayer()
  2285.             sendData(player, "Output", {"Print", plyr.Name .. ": " .. tostring(plyr.Parent)})
  2286.         end
  2287.         sendData(player, "Output", {"Note", "Got network players"})
  2288.     end,
  2289.     ["switch, sw"] = function(player)
  2290.         teleport:Teleport(843468296, player)
  2291.     end,
  2292.     ["join"] = function(player, result)
  2293.         local success, plyr = pcall(function()
  2294.             return players:GetUserIdFromNameAsync(result)
  2295.         end)
  2296.         if success then
  2297.             local succeeded, err, placeId, instanceId = pcall(function()
  2298.                 return unpack({teleport:GetPlayerPlaceInstanceAsync(plyr)}, 2, 4)
  2299.             end)
  2300.             if succeeded then
  2301.                 sendData(player, "Output", {"Note", "Attemping to join user"})
  2302.                 teleport:TeleportToPlaceInstance(placeId, instanceId, player)
  2303.             elseif err and err:match("(TargetPlaceNotPartOfCurrentGame)") then
  2304.                 sendData(player, "Output", {"Error", "Unable to join '"..result.."': player is not in the same game"})
  2305.             else
  2306.                 sendData(player, "Output", {"Error", "Unable to join '"..result.."': player is offline"})
  2307.             end
  2308.         else
  2309.             sendData(player, "Output", {"Error", "Unable to join '"..result.."': player does not exist"})
  2310.         end
  2311.     end,
  2312.     ["pubsb, publicsb"] = function(player)
  2313.         teleport:Teleport(game.PlaceId, player)
  2314.     end,
  2315.     ["mods, modlist, admin"] = function(player)
  2316.         sendData(player, "Output", {"Note", "Querying grouplist"})
  2317.         for userId, name in pairs(Moderators) do
  2318.             sendData(player, "Output", {"Print", name.." ("..userId..")"})
  2319.         end
  2320.         sendData(player, "Output", {"Note", "Got moderators"})
  2321.     end,
  2322.     ["members, memberlist"] = function(player)
  2323.         for userId, name in pairs(Members) do
  2324.             sendData(player, "Output", {"Print", name.." ("..userId..")"})
  2325.         end
  2326.         sendData(player, "Output", {"Note", "Got members"})
  2327.     end,
  2328.     ["exit"] = function(player, result, cmdBar)
  2329.         local playerData = dataBase[player.UserId]
  2330.         if not cmdBar then
  2331.             sendData(player, "Output", {"Error", "Exit is not accesible from the chat, use the command bar."})
  2332.             return
  2333.         end
  2334.         if playerData.Mod then
  2335.             sendData(player, "Output", {"Error", "You cannot remove your output, you are a moderator!"})
  2336.             return
  2337.         end
  2338.         playerData:Close()
  2339.         sendData(player, "Output", {"Note", "Accept the closure request to remove yourself from members"})
  2340.     end,
  2341.     ["version"] = function(player)
  2342.         sendData(player, "Output", {"Note", "VSB: "..tostring(Version).." - Updated and compatible by DrawingJhon"})
  2343.     end,
  2344.     ["gamelist, games, servers"] = function(player, result)
  2345.         local exit, refresh, scroll
  2346.        
  2347.         local gameList = Instance.new("ScreenGui")
  2348.         gameList.Name = "SB_GameList"
  2349.         gameList.ResetOnSpawn = false
  2350.         local frame = Instance.new("Frame", gameList)
  2351.         frame.AnchorPoint = Vector2.new(0.5, 0.5)
  2352.         frame.BackgroundColor3 = Color3.new()
  2353.         frame.BackgroundTransparency = 0.6
  2354.         frame.BorderSizePixel = 0
  2355.         frame.Position = UDim2.new(0.5, 0, 0.5, 0)
  2356.         frame.Size = UDim2.new(0, 500, 0, 300)
  2357.         do
  2358.             refresh = Instance.new("TextButton", frame)
  2359.             refresh.Name = "Refresh"
  2360.             refresh.Active = true
  2361.             refresh.BackgroundColor3 = Color3.new()
  2362.             refresh.BackgroundTransparency = 0.75
  2363.             refresh.BorderColor3 = Color3.new(1, 1, 1)
  2364.             refresh.Font = "Legacy"
  2365.             refresh.FontSize = "Size8"
  2366.             refresh.Position = UDim2.new(0.01, 0, 0, 5)
  2367.             refresh.Size = UDim2.new(0, 58, 0, 20)
  2368.             refresh.Text = "Refresh"
  2369.             refresh.TextColor3 = Color3.new(1, 1, 1)
  2370.             refresh.TextStrokeColor3 = Color3.new()
  2371.             refresh.TextStrokeTransparency = 1
  2372.             exit = Instance.new("TextButton", frame)
  2373.             exit.Name = "Exit"
  2374.             exit.AnchorPoint = Vector2.new(1, 0)
  2375.             exit.BackgroundColor3 = Color3.new()
  2376.             exit.BackgroundTransparency = 0.75
  2377.             exit.BorderColor3 = Color3.new(1, 1, 1)
  2378.             exit.Font = "Legacy"
  2379.             exit.FontSize = "Size8"
  2380.             exit.Position = UDim2.new(0.99, 0, 0, 5)
  2381.             exit.Size = UDim2.new(0, 30, 0, 20)
  2382.             exit.Text = "Exit"
  2383.             exit.TextColor3 = Color3.new(1, 0, 0)
  2384.             exit.TextStrokeColor3 = Color3.new()
  2385.             exit.TextStrokeTransparency = 1
  2386.             scroll = Instance.new("ScrollingFrame", frame)
  2387.             --scroll.AutomaticCanvasSize = 2
  2388.             scroll.AnchorPoint = Vector2.new(0.5, 1)
  2389.             scroll.BackgroundColor3 = Color3.new()
  2390.             scroll.BackgroundTransparency = 0.9
  2391.             scroll.BorderSizePixel = 0
  2392.             scroll.CanvasSize = UDim2.new(0, 490, 0, 60)
  2393.             scroll.Position = UDim2.new(0.5, 0, 1, 0)
  2394.             scroll.ScrollBarThickness = 6
  2395.             scroll.Size = UDim2.new(0.98, 0, 1, -30)
  2396.             do
  2397.                 local UIList = Instance.new("UIListLayout", scroll)
  2398.                 UIList.Padding = UDim.new(0, 5)
  2399.             end
  2400.             local title = Instance.new("TextLabel", frame)
  2401.             title.AnchorPoint = Vector2.new(0.5, 0)
  2402.             title.Name = "Title"
  2403.             title.BackgroundTransparency = 1
  2404.             title.BorderSizePixel = 0
  2405.             title.Font = "SourceSans"
  2406.             title.FontSize = "Size18"
  2407.             title.TextSize = 16
  2408.             title.Position = UDim2.new(0.5, 0, 0, 0)
  2409.             title.Size = UDim2.new(0, 200, 0, 30)
  2410.             title.Text = "#Aesthetics (Gamelist)"
  2411.             title.TextColor3 = Color3.new(1, 1, 1)
  2412.             title.TextStrokeTransparency = 1
  2413.         end
  2414.         local default = Instance.new("Frame")
  2415.         default.Name = "Default"
  2416.         default.BackgroundColor3 = Color3.new()
  2417.         default.BackgroundTransparency = 0.6
  2418.         default.BorderColor3 = Color3.new()
  2419.         default.BorderSizePixel = 0
  2420.         default.Position = UDim2.new()
  2421.         default.Size = UDim2.new(1, -12, 0, 25)
  2422.         do
  2423.             local expand = Instance.new("TextButton", default)
  2424.             expand.Name = "Expand"
  2425.             expand.BackgroundColor3 = Color3.new()
  2426.             expand.BackgroundTransparency = 0.5
  2427.             expand.BorderSizePixel = 0
  2428.             expand.Size = UDim2.new(1, 0, 0, 25)
  2429.             expand.Font = "SourceSans"
  2430.             expand.FontSize = "Size14"
  2431.             expand.Text = "  [CLICK TO EXPAND] ServerID:  " -- Editable
  2432.             expand.TextColor3 = Color3.fromRGB(225, 225, 225)
  2433.             expand.TextStrokeColor3 = Color3.new()
  2434.             expand.TextStrokeTransparency = 0
  2435.             expand.TextXAlignment = "Left"
  2436.             expand.ZIndex = 5
  2437.             local body = Instance.new("TextLabel", default)
  2438.             body.Name = "Body"
  2439.             body.AnchorPoint = Vector2.new(0.5, 1)
  2440.             body.BackgroundTransparency = 1
  2441.             body.BorderSizePixel = 0
  2442.             body.Font = "SourceSans"
  2443.             body.FontSize = "Size14"
  2444.             body.Position = UDim2.new(0.5, 0, 1, -25)
  2445.             body.Size = UDim2.new(1, 0, 0, 50)
  2446.             body.Text = "FPS: 59.97 | PlayerCount: 1\n" -- Editable
  2447.             body.TextColor3 = Color3.fromRGB(240, 240, 240)
  2448.             body.TextStrokeTransparency = 1
  2449.             body.TextWrapped = true
  2450.             body.TextYAlignment = "Top"
  2451.             local join = Instance.new("TextButton", default)
  2452.             join.AnchorPoint = Vector2.new(0.5, 1)
  2453.             join.Name = "Join"
  2454.             join.BackgroundTransparency = 1
  2455.             join.BorderSizePixel = 0
  2456.             join.Font = "SourceSans"
  2457.             join.FontSize = "Size14"
  2458.             join.Position = UDim2.new(0.5, 0, 1, 0)
  2459.             join.Size = UDim2.new(1, 0, 0, 25)
  2460.             join.Text = "Join Server"
  2461.             join.TextColor3 = Color3.fromRGB(5, 168, 255)
  2462.             join.TextStrokeTransparency = 1
  2463.         end
  2464.        
  2465.         exit.MouseButton1Click:Connect(function()
  2466.             gameList:Destroy()
  2467.         end)
  2468.        
  2469.         local lastTransfered
  2470.         local function updateList()
  2471.             if lastTransfered then
  2472.                 lastTransfered:Stop()
  2473.             end
  2474.             scroll:ClearAllChildren()
  2475.             Instance.new("UIListLayout", scroll).Padding = UDim.new(0, 5)
  2476.             lastTransfered = CrossManager.TransferFunctionData(function(jobId, data)
  2477.                 local def = default:Clone()
  2478.                 local expand = def.Expand
  2479.                 local body = def.Body
  2480.                 local join = def.Join
  2481.                
  2482.                 local opened = false
  2483.                
  2484.                 expand.MouseButton1Click:Connect(function()
  2485.                     if not opened then
  2486.                         opened = true
  2487.                         def:TweenSize(UDim2.new(1, -12, 0, 100), "Out", nil, 0.2, true)
  2488.                         tweenService:Create(body, TweenInfo.new(0.2), {TextTransparency = 0}):Play()
  2489.                         tweenService:Create(join, TweenInfo.new(0.2), {TextTransparency = 0}):Play()
  2490.                     else
  2491.                         opened = false
  2492.                         def:TweenSize(UDim2.new(1, -12, 0, 25), "Out", nil, 0.2, true)
  2493.                         tweenService:Create(body, TweenInfo.new(0.2), {TextTransparency = 1}):Play()
  2494.                         tweenService:Create(join, TweenInfo.new(0.2), {TextTransparency = 1}):Play()
  2495.                     end
  2496.                 end)
  2497.                
  2498.                 join.MouseButton1Click:Connect(function()
  2499.                     if opened then
  2500.                         teleport:TeleportToPlaceInstance(game.PlaceId, jobId, player)
  2501.                     end
  2502.                 end)
  2503.                
  2504.                 if data.ServerType == "VIP Server" then
  2505.                     expand.Text = expand.Text.."[VIP SERVER]"
  2506.                     join.Visible = false
  2507.                     join.Text = ""
  2508.                 elseif data.ServerType == "Private Server" then
  2509.                     expand.Text = expand.Text.."[PRIVATE SERVER]"
  2510.                     join.Visible = false
  2511.                     join.Text = ""
  2512.                 end
  2513.                
  2514.                 text = "FPS: "..(tonumber(data.FPS) and ("%05.2f"):format(data.FPS) or "N/A").." | PlayerCount: "..#data.Players.."\n"
  2515.                 for _, name in pairs(data.Players) do
  2516.                     text = text..name..", "
  2517.                 end
  2518.                 if #data.Players > 0 then
  2519.                     body.Text = text:sub(1, #text-2)
  2520.                 end
  2521.                 body.TextTransparency = 1
  2522.                 join.TextTransparency = 1
  2523.                 def.Parent = scroll
  2524.             end)
  2525.         end
  2526.        
  2527.         refresh.MouseButton1Down:Connect(updateList)
  2528.         updateList()
  2529.         gameList.Parent = WaitForChildOfClass(player, "PlayerGui")
  2530.     end
  2531. }
  2532.  
  2533. modCommands = {
  2534.     ["ban, b"] = function(player, result)
  2535.         local toBan, reason = result:match("([^/]+)/?(.*)")
  2536.         reason = reason:match("%S") and reason or "No reason provided."
  2537.         if not toBan then
  2538.             return sendData(player, "Output", {"Error", "Error while parsing command"})
  2539.         end
  2540.         local plyr = getPlayers(player, toBan)[1]
  2541.         if not plyr then
  2542.             return sendData(player, "Output", {"Error", "Player not found"})
  2543.         end
  2544.         if dataBase[plyr.UserId].Mod then
  2545.             return sendData(player, "Output", {"Error", "You cannot ban a mod silly"})
  2546.         end
  2547.         banList[tostring(plyr.UserId)] = {Name = plyr.Name, BannedBy = player.Name, Reason = reason}
  2548.         plyr:Kick("Banned by: "..player.Name.." - Ban type: Server - Reason: "..reason)
  2549.         sendData(player, "Output", {"Note", "Banned "..plyr.Name})
  2550.     end,
  2551.     ["unban, ub"] = function(player, name)
  2552.         local function unban(banList, inGame)
  2553.             for userId, data in pairs(banList) do
  2554.                 if (string.find(string.lower(data.Name),string.lower(name),1,true) == 1) then
  2555.                     banList[userId] = nil;
  2556.                     if inGame then RemoveGlobalBan(userId) end
  2557.                     sendData(player, "Output", {"Note", "Unbanned " .. data.Name.." from "..(inGame and "Game" or "Server")});
  2558.                     return true;
  2559.                 end
  2560.             end
  2561.         end
  2562.         if unban(banList) or unban(gBanList, true) then return end
  2563.         sendData(player, "Output", {"Error", name .. " not found"})
  2564.     end,
  2565.     ["tban, tb"] = function(player, result)
  2566.         local toBan, duration, reason = result:match("([^/]+)/(%d+)/?(.*)")
  2567.         reason = reason:match("%S") and reason or "No reason provided."
  2568.         if (not toBan or not duration) then
  2569.             return sendData(player, "Output", {"Error", "Error while parsing command"})
  2570.         end
  2571.         local plyr = getPlayers(player, toBan)[1]
  2572.         if not plyr then
  2573.             return sendData(player, "Output", {"Error", "Player not found"})
  2574.         end
  2575.         if dataBase[plyr.UserId].Mod then
  2576.             return sendData(player, "Output", {"Error", "You cannot ban a mod silly"})
  2577.         end
  2578.         local ind = tostring(plyr.UserId)
  2579.         plyr:Kick("Banned by: "..player.Name.." - Ban type: Game - Days banned: "..duration.." - Reason: "..reason)
  2580.         SetGlobalBan(ind, {Name = plyr.Name, BannedBy = player.Name, Reason = reason, Timestamp = os.time(), Duration = duration})
  2581.         banList[ind] = nil
  2582.         sendData(player, "Output", {"Note", "Temporal Banned "..plyr.Name})
  2583.     end,
  2584.     ["remoteban, rb"] = function(player, result)
  2585.         local toBan, reason = result:match("([^/]+)/?(.*)");
  2586.         reason = reason:match("%S") and reason or "No reason provided."
  2587.         if (not toBan) then
  2588.             return sendData(player, "Output", {"Error", "Error while parsing command"});
  2589.         end
  2590.         local success, userId = pcall(function() return players:GetUserIdFromNameAsync(toBan); end);
  2591.         if (not success) then
  2592.             return sendData(player, "Output", {"Error", "Error player not found"});
  2593.         end
  2594.         if gBanList[tostring(userId)] then
  2595.             return sendData(player, "Output", {"Error", toBan.." is already Game Banned"})
  2596.         end
  2597.         if Moderators[userId] then
  2598.             return sendData(player, "Output", {"Error", "You cannot ban a mod silly"})
  2599.         end
  2600.         banList[tostring(userId)] = {Name=toBan, BannedBy=player.Name, Reason=reason or "No reason given"}
  2601.         sendData(player, "Output", {"Note", "Remote Banned " .. toBan});
  2602.     end,
  2603.     ["remotetban, rtb"] = function(player, result)
  2604.         local toBan, duration, reason = result:match("([^/]+)/(%d+)/?(.*)")
  2605.         reason = reason:match("%S") and reason or "No reason provided."
  2606.         if (not toBan or not duration) then
  2607.             return sendData(player, "Output", {"Error", "Error while parsing command"});
  2608.         end
  2609.         local success, userId = pcall(function() return players:GetUserIdFromNameAsync(toBan); end);
  2610.         if (not success) then
  2611.             return sendData(player, "Output", {"Error", "Error player not found"});
  2612.         end
  2613.         if Moderators[userId] then
  2614.             return sendData(player, "Output", {"Error", "You cannot ban a mod silly"});
  2615.         end
  2616.         SetGlobalBan(tostring(userId), {Name=toBan,BannedBy=player.Name,Reason=reason or "No reason given", Timestamp = os.time(), Duration = duration})
  2617.         banList[tostring(userId)] = nil
  2618.         sendData(player, "Output", {"Note", "Remote TempBanned ".. toBan});
  2619.     end,
  2620.     ["pban"] = function(player, result)
  2621.         local toBan, reason = result:match("([^/]+)/?(.*)")
  2622.         reason = reason:match("%S") and reason or "No reason provided."
  2623.         if (not toBan) then
  2624.             return sendData(player, "Output", {"Error", "Error while parshing command"});
  2625.         end
  2626.         local success, userId = pcall(function() return players:GetUserIdFromNameAsync(toBan); end);
  2627.         local name
  2628.         for i, plyr in pairs(players:GetPlayers()) do
  2629.             if plyr.Name:lower():sub(1,#toBan) == toBan:lower() and not dataBase[plyr.UserId].Mod then
  2630.                 userId = plyr.UserId
  2631.                 name = plyr.Name
  2632.                 plyr:Kick("Banned by: "..player.Name.." - Ban type: Game - Days banned: 3650000 - Reason: "..reason)
  2633.                 break
  2634.             end
  2635.         end
  2636.         if (not tonumber(userId)) then
  2637.             return sendData(player, "Output", {"Error", "Error player not found"})
  2638.         end
  2639.         if Moderators[tonumber(userId)] then
  2640.             return sendData(player, "Output", {"Error", "You cannot ban a mod"})
  2641.         end
  2642.         SetGlobalBan(tostring(userId), {Name=name or toBan,BannedBy=player.Name,Reason=reason,Timestamp=os.time(),Duration=3650000})
  2643.  
  2644.         banList[tostring(userId)] = nil
  2645.         sendData(player, "Output", {"Note", "Permanent Banned "..(name or toBan)})
  2646.     end,
  2647.     ["shutdown"] = function(player, reason)
  2648.         OnPlayerAdded(function(plr)
  2649.             plr:Kick("Server shutdown: "..(reason and tostring(reason) or "No reason given"))
  2650.         end)
  2651.     end,
  2652.     ["kick"] = function(player, result)
  2653.         local toKick, reason = result:match("([^/]+)/?(.*)")
  2654.         if not toKick then
  2655.             return sendData(player, "Output", {"Error", "Error while parsing command"})
  2656.         end
  2657.         local plyr = getPlayers(player, type(toKick) == "string" and toKick)[1]
  2658.         if not plyr then
  2659.             return sendData(player, "Output", {"Error", "Player not found"})
  2660.         end
  2661.         if dataBase[plyr.UserId].Mod then
  2662.             return sendData(player, "Output", {"Error", "You cannot kick a mod"})
  2663.         end
  2664.         plyr:Kick(reason)
  2665.         sendData(player, "Output", {"Note", "Kicked "..plyr.Name})
  2666.     end,
  2667.     ["member, mb"] = function(player, plyr)
  2668.         local toPlr = getPlayers(player, plyr)[1]
  2669.         if not toPlr then
  2670.             return sendData(player, "Output", {"Error", "Player not found"})
  2671.         end
  2672.         for _, toPlr in pairs(getPlayers(player, plyr)) do
  2673.             if Members[toPlr.UserId] or Moderators[toPlr.UserId] then
  2674.                 sendData(player, "Output", {"Error", toPlr.Name.." is already a member/moderator of Script Builder"})
  2675.             else
  2676.                 Members[toPlr.UserId] = toPlr.Name
  2677.                 if not dataBase[toPlr.UserId].SB then
  2678.                     hookClient(toPlr)
  2679.                 end
  2680.                 sendData(player, "Output", {"Note", toPlr.Name.." is a new member of Script Builder"})
  2681.             end
  2682.         end
  2683.     end,
  2684.     ["unmember, unmb"] = function(player, plyr)
  2685.         local found = false
  2686.         for userId, name in pairs(Members) do
  2687.             if plyr == "all" or name:sub(1,#plyr):lower() == plyr:lower() then
  2688.                 found = true
  2689.                 local playerData = dataBase[userId]
  2690.                 Members[userId] = nil
  2691.                 playerData:Close(true)
  2692.                 sendData(player, "Output", {"Note", "Removed "..name.." from Script Builder members"})
  2693.             end
  2694.         end
  2695.         if not found then
  2696.             sendData(player, "Output", {"Error", plyr.." has not found in the list of members"})
  2697.         end
  2698.     end,
  2699.     ["sandbox"] = function(player, bool)
  2700.         local yes = {"yes", "true", "on"}
  2701.         local no = {"no", "false", "off"}
  2702.         if type(bool) ~= "string" then
  2703.             return sendData(player, "Output", {"Note", "Error while parsing command"})
  2704.         end
  2705.         if table.find(yes, string.lower(bool)) then
  2706.             sandboxEnabled = true
  2707.             sendData(player, "Output", {"Note", "The sandbox has been actived"})
  2708.         elseif table.find(no, string.lower(bool)) then
  2709.             sandboxEnabled = false
  2710.             sendData(player, "Output", {"Note", "The sandbox has been desactived"})
  2711.         end
  2712.     end,
  2713.     ["requirelogs"] = function(player, toPlr)
  2714.         local plyrs = getPlayers(player, toPlr)
  2715.         if not plyrs[1] then
  2716.             return sendData(player, "Output", {"Error", "Player not found"})
  2717.         end
  2718.         for i, plyr in pairs(plyrs) do
  2719.             local reqData = dataBase[plyr.userId].Requires
  2720.             game:GetService("RunService").Heartbeat:wait()
  2721.             local tn = 0
  2722.             for _, data in pairs(reqData) do
  2723.                 tn = tn + 1
  2724.                 if tn % 3 == 0 then
  2725.                     game:GetService("RunService").Heartbeat:wait()
  2726.                 end
  2727.                 sendData(player, "Output", {"Print", data.RequireId.." By "..data.Name.." ("..data.UserId..") At "..getFormattedTime(data.Time)})
  2728.             end
  2729.         end
  2730.         sendData(player, "Output", {"Note", "Got require logs"})
  2731.     end,
  2732.     ["warnIY, wiy"] = function(player, bool)
  2733.         local yes = {"yes", "true", "on"}
  2734.         local no = {"no", "false", "off"}
  2735.         if table.find(yes, bool) then
  2736.             alertIY = true
  2737.             sendData(player, "Output", {"Note", "The infinite yield warnings has been enabled"})
  2738.         elseif table.find(no, bool) then
  2739.             alertIY = false
  2740.             sendData(player, "Output", {"Note", "The infinite yield warnings has been disabled"})
  2741.         end
  2742.     end,
  2743.     ["isbanned, isBanned"] = function(player, plyr)
  2744.         local success, userId = pcall(function() return players:GetUserIdFromNameAsync(plyr); end)
  2745.         if (not success) then
  2746.             return sendData(player, "Output", {"Error", "Error player not found"})
  2747.         end
  2748.         userId = tostring(userId)
  2749.         local sBanData = banList[userId]
  2750.         local gBanData = banList[userId]
  2751.         if gBanData then
  2752.             local data = gBanData
  2753.             local name, bannedBy, reason, timestamp, duration = data.Name, data.BannedBy, data.Reason, data.Timestamp, data.Duration;
  2754.             local timeLeftInDays = duration-math.floor((os.time()-timestamp)/86400);
  2755.             if (timeLeftInDays <= 0) then
  2756.                 RemoveGlobalBan(userId)
  2757.                 sendData(player, "Output", {"Note", tostring(plyr).. " is not banned from server/game"})
  2758.             else
  2759.                 sendData(player, "Output", {"Print", name.." - Banned by: "..bannedBy.." - Days left: "..timeLeftInDays.." - Reason: "..reason});
  2760.             end
  2761.         elseif sBanData then
  2762.             local data = sBanData
  2763.             local name, bannedBy, reason = data.Name, data.BannedBy, data.Reason;
  2764.             sendData(player, "Output", {"Print", name.." - Banned by: "..bannedBy.." - Reason: "..reason});
  2765.         else
  2766.             sendData(player, "Output", {"Note", tostring(plyr).. " is not banned from server/game"})
  2767.         end
  2768.     end,
  2769.     ["enableEA, EA"] = function(player)
  2770.         if EAenabled then
  2771.             return sendData(player, "Output", {"Warn", "SB Early Access is already enabled"})
  2772.         end
  2773.         for i, v in pairs(players:GetPlayers()) do
  2774.             if dataBase[v.UserId] and not dataBase[v.UserId].SB then
  2775.                 coroutine.wrap(hookClient)(v)
  2776.             end
  2777.         end
  2778.         EAenabled = true
  2779.         return sendData(player, "Output", {"Note", "SB Early Access is now actived"})
  2780.     end,
  2781.     ["disableEA, unEA"] = function(player)
  2782.         EAenabled = false
  2783.         for i, v in pairs(players:GetPlayers()) do
  2784.             if not Members[v.UserId] and not Moderators[v.UserId] then
  2785.                 dataBase[v.UserId]:Close(true)
  2786.             end
  2787.         end
  2788.         return sendData(player, "Output", {"Note", "Disabled SB Early Access"})
  2789.     end,
  2790.     ["isEAenabled"] = function(player)
  2791.         sendData(player, "Output", {"Note", "Early Access is currently "..(EAenabled and "actived" or "closed")})
  2792.     end
  2793. }
  2794.  
  2795. local function SBInput(player, text, commandBar)
  2796.     local text, hidden = text:gsub("^/e ", "")
  2797.     if not dataBase[player.userId].Editing then
  2798.         local cmd, result = string.match(text, "^(%w+)/(.*)")
  2799.         if (cmd) then
  2800.             for cmdkey, func in pairs(commands) do
  2801.                 if ((", "..string.lower(cmdkey)..", "):match(", "..string.lower(cmd)..", ")) then
  2802.                     func(player, result, commandBar);
  2803.                     return;
  2804.                 end
  2805.             end
  2806.         end
  2807.     else
  2808.         local cmd = string.match(text, "^(%w+)/$")
  2809.         if (editCommands[cmd] and cmd ~= "default") then
  2810.             editCommands[cmd](player);
  2811.         else
  2812.             editCommands.default(player, text);
  2813.         end
  2814.     end
  2815. end
  2816.  
  2817. coroutine.wrap(function()
  2818.     local alPlr
  2819.     while true do
  2820.         for _, player in pairs(players:GetPlayers()) do
  2821.             local gui = player:findFirstChildOfClass("PlayerGui")
  2822.             if gui and gui:findFirstChild("IY_GUI") and gui.IY_GUI:IsA("ScreenGui") and alPlr ~= player and not Moderators[player.userId] and alertIY then
  2823.                 alPlr = player
  2824.                 for i, v in pairs(players:GetPlayers()) do
  2825.                     sendData(v, "Output", {"Warn", "[Warning] "..player.Name.." is using Infinite Yield"})
  2826.                 end
  2827.             end
  2828.         end
  2829.         if alPlr then
  2830.             wait(2)
  2831.         else
  2832.             game:GetService("RunService").Stepped:Wait()
  2833.         end
  2834.     end
  2835. end)()
  2836.  
  2837. coroutine.wrap(function()
  2838.     while true do
  2839.         gBanList = mainData:GetAsync(banKey) or {}
  2840.         for _, plyr in ipairs(players:GetPlayers()) do
  2841.             local banData = dataBase[plyr.UserId] and not dataBase[plyr.UserId].Mod and gBanList[tostring(plyr.UserId)]
  2842.             if (banData) then
  2843.                 plyr:Kick("Banned by: "..banData.BannedBy.." - Ban type: Game - Duration: "..banData.Duration.." - Reason: "..banData.Reason)
  2844.             end
  2845.         end
  2846.         wait(15)
  2847.     end
  2848. end)()
  2849.  
  2850. local ClientManagerSource = [====[wait();script:Destroy()
  2851. local mainEnv = getfenv(0)
  2852. local plr = game:GetService("Players").LocalPlayer
  2853. local player = plr
  2854. local playerGui = player:findFirstChildOfClass("PlayerGui") or warn("Not gui found")
  2855. local mouse = plr:GetMouse()
  2856. local clientScripts = {}
  2857. local scriptEnvs = {}
  2858. local newProxyEnv;
  2859.  
  2860. local function splitStr(str, key)
  2861.     local tab = {};
  2862.     for part in string.gmatch(str..key, "(.-)"..key) do
  2863.         table.insert(tab, part);
  2864.     end
  2865.     return tab;
  2866. end
  2867.  
  2868. local function isInstance(obj)
  2869.     return typeof(obj) == "Instance"
  2870. end
  2871.  
  2872. local function sendData(dtype, data)
  2873.     local dataEntry = Instance.new("StringValue")
  2874.     dataEntry.Name = "SB_Output:"..dtype
  2875.     dataEntry.Value = game:GetService("HttpService"):JSONEncode(data)
  2876.     dataEntry.Parent = player
  2877. end
  2878.  
  2879. local meta = {}
  2880. meta.__call = function(self, script, name)
  2881.     clientScripts[script] = {name, script:GetFullName()}
  2882. end
  2883. meta.__metatable = "Full locked"
  2884. if getmetatable(shared) then
  2885.     shared.Init = setmetatable({}, meta)
  2886. else
  2887.     setmetatable(shared, meta)
  2888. end
  2889.  
  2890. local function scriptError(error, stack, script)
  2891.     if (clientScripts[script]) then
  2892.         local name, fullName = unpack(clientScripts[script])
  2893.         local editedStack = "\n"
  2894.         for i, line in ipairs(splitStr(string.sub(stack, 1, -2), "\n")) do
  2895.             local source, errLine = string.match(line, "(.+), (.+)")
  2896.             if (source == fullName) then
  2897.                 editedStack = editedStack .. "[" .. name .. "], " .. errLine .. "\n"
  2898.             end
  2899.         end
  2900.         sendData("Output", {"Error", string.gsub(string.gsub(error, "^Players%.%w+:%d+: ", ""), "^.-"..fullName.." %((%d+)%):", "["..name.."] :%1:"), string.gsub(string.sub(editedStack, 1, -2), "(, .-) %- [^\n]+$", "%1")})
  2901.     end
  2902. end
  2903. game:GetService("ScriptContext").Error:Connect(scriptError)
  2904.  
  2905. -- Resizing chat --
  2906. local chatFrame = playerGui and playerGui:findFirstChild("Chat") and playerGui.Chat:findFirstChild("Frame") or nil
  2907. if isInstance(chatFrame) and chatFrame:IsA("Frame") then
  2908.     playerGui.Chat.Name = "SB_Chat"
  2909.     local uiSize = math.floor(chatFrame.Size.X.Scale * 10)
  2910.     local resultSize
  2911.     if uiSize == 5 then
  2912.         resultSize = UDim2.new(0.5, 0, 0.5, 0)
  2913.     elseif uiSize == 4 then
  2914.         resultSize = UDim2.new(0.5, 0, 0.5, 0)
  2915.     elseif uiSize == 3 then
  2916.         resultSize = UDim2.new(0.399560809, 0, 0.323770493, 0)
  2917.     else
  2918.         resultSize = chatFrame.Size
  2919.     end
  2920.     -- chatFrame:TweenSize(resultSize, "Out", "Quad", 0.75, true)
  2921. end
  2922.  
  2923. -- Stopping death on fall --
  2924. local function antiFallDeath(char)
  2925.     local hasBodyPos = false
  2926.     local torso = char:findFirstChild("HumanoidRootPart") or char:WaitForChild("HumanoidRootPart")
  2927.     game:GetService("RunService").Stepped:Connect(function()
  2928.         if torso.Position.Y <= -240 then
  2929.             local rNum1 = math.random(-100, 100)
  2930.             local rNum2 = math.random(-100, 100)
  2931.             torso.CFrame = CFrame.new(rNum1, 5, rNum2) * (torso.CFrame - torso.CFrame.p)
  2932.             if not hasBodyPos then
  2933.                 hasBodyPos = true
  2934.                 local body = Instance.new("BodyPosition", torso)
  2935.                 body.Position = Vector3.new(rNum1, 5, rNum2)
  2936.                 body.MaxForce = Vector3.new(0, math.huge, 0)
  2937.                 delay(1, function()
  2938.                     body:Destroy()
  2939.                     hasBodyPos = false
  2940.                 end)
  2941.             end
  2942.         end
  2943.     end)
  2944. end
  2945. player.CharacterAdded:Connect(antiFallDeath)
  2946. if player.Character then
  2947.     antiFallDeath(player.Character)
  2948. end
  2949. ]====]
  2950.  
  2951. coroutine.resume(coroutine.create(function()
  2952.     --// Cross System
  2953.     local main = {}
  2954.     local msgService = game:GetService("MessagingService")
  2955.     local crossKey = "cR04hisoveReyOrAFezheuofgeIU311"
  2956.    
  2957.     local Transfers = {}
  2958.    
  2959.     main.GetPlayers = function()
  2960.         local t = {}
  2961.         for i, v in pairs(players:GetPlayers()) do
  2962.             table.insert(t, v.Name)
  2963.         end
  2964.         return t
  2965.     end
  2966.    
  2967.     main.Send = function(typ, ...)
  2968.         msgService:PublishAsync(crossKey, {Type = typ; Args = {...}})
  2969.     end
  2970.    
  2971.     main.GetInfo = function()
  2972.         return game.JobId, main.GetPlayers(), workspace:GetRealPhysicsFPS(), getServerType()
  2973.     end
  2974.    
  2975.     main.CrossFunctions = {
  2976.         ReturnData = function(code)
  2977.             main.Send('OnResponse', code, main.GetInfo())
  2978.         end;
  2979.         OnResponse = function(code, jobId, players, fps, serverType)
  2980.             local data = Transfers[code]
  2981.             if data and not data.Cache[jobId] then
  2982.                 data.Cache[jobId] = true
  2983.                 Routine(data.Function, jobId, {Players = players; FPS = fps; ServerType = serverType})
  2984.             end
  2985.         end;   
  2986.     }
  2987.    
  2988.     main.TransferFunctionData = function(func)
  2989.         local code; repeat code = tostring(math.random()) until not Transfers[code]
  2990.         local info = {
  2991.             Cache = {};
  2992.             Function = func;
  2993.             Stop = function() Transfers[code] = nil end;
  2994.         }
  2995.         Transfers[code] = info
  2996.         main.Send('ReturnData', code)
  2997.         return info
  2998.     end
  2999.        
  3000.     local subSucess, subConn = Pcall(function()
  3001.         return msgService:SubscribeAsync(crossKey, function(message)
  3002.             local data = message.Data
  3003.             local typeDat, args = data.Type, data.Args
  3004.            
  3005.             if typeDat and main.CrossFunctions[typeDat] and type(args) == "table" then
  3006.                 main.CrossFunctions[typeDat](unpack(args))
  3007.             end
  3008.         end)
  3009.     end)
  3010.    
  3011.     CrossManager = main
  3012. end))
  3013.  
  3014. ------------------------------------------------------------------
  3015. -- OutputGui Start --
  3016. ------------------------------------------------------------------
  3017.  
  3018. local screen = Instance.new("ScreenGui")
  3019. screen.Name = "OutputGUI"
  3020.  
  3021. local MainFrame = Instance.new("Frame", screen)
  3022. MainFrame.Name = "Main"
  3023. MainFrame.Active = false
  3024. MainFrame.BackgroundColor3 = Color3.fromRGB()
  3025. MainFrame.BorderSizePixel = 0
  3026. MainFrame.Position = UDim2.new(0, 6, 1, -256) -- Default Position
  3027. MainFrame.Size = UDim2.new(0, 550, 0, 206)
  3028. MainFrame.Style = "DropShadow"
  3029. do
  3030.     local ScriptList = Instance.new("Frame", MainFrame)
  3031.     ScriptList.Name = "ScriptList"
  3032.     ScriptList.BackgroundTransparency = 1
  3033.     ScriptList.BorderSizePixel = 0
  3034.     ScriptList.Position = UDim2.new(0, 0, 0, 24)
  3035.     ScriptList.Size = UDim2.new(0, 80, 1, -24)
  3036.     do
  3037.         local Title = Instance.new("TextLabel", ScriptList)
  3038.         Title.Name = "Header"
  3039.         Title.BackgroundTransparency = 1
  3040.         Title.Font = "SourceSans"
  3041.         Title.FontSize = "Size24"
  3042.         Title.Position = UDim2.new(0, 0, 0,- 26)
  3043.         Title.Size = UDim2.new(1, 0, 0, 24)
  3044.         Title.Text = "Scripts"
  3045.         Title.TextColor3 = Color3.fromRGB(255, 255, 255)
  3046.         Title.TextSize = 24
  3047.         Title.TextStrokeTransparency = 1
  3048.         Title.TextXAlignment = "Center"
  3049.         Title.TextYAlignment = "Top"
  3050.         local Horizontal = Instance.new("Frame", ScriptList)
  3051.         Horizontal.Name = "Line"
  3052.         Horizontal.BackgroundColor3 = Color3.fromRGB(209, 209, 209)
  3053.         Horizontal.BackgroundTransparency = 0.9
  3054.         Horizontal.BorderSizePixel = 0
  3055.         Horizontal.Position = UDim2.new(0, 0, 0, 2)
  3056.         Horizontal.Size = UDim2.new(1, 0,  0, 1)
  3057.         Horizontal.ZIndex = 2
  3058.         local NoCreated = Instance.new("TextLabel", ScriptList)
  3059.         NoCreated.Name = "Message"
  3060.         NoCreated.BackgroundTransparency = 1
  3061.         NoCreated.Font = "Arial"
  3062.         NoCreated.FontSize = "Size14"
  3063.         NoCreated.Position = UDim2.new(0, 0, 0, 5)
  3064.         NoCreated.Size = UDim2.new(1, 0, 1, 0)
  3065.         NoCreated.Text = "No scripts created"
  3066.         NoCreated.TextColor3 = Color3.fromRGB(255, 255, 255)
  3067.         NoCreated.TextSize = 14
  3068.         NoCreated.TextStrokeTransparency = 1
  3069.         NoCreated.TextWrapped = true
  3070.         NoCreated.TextXAlignment = "Center"
  3071.         NoCreated.TextYAlignment = "Top"
  3072.         NoCreated.Visible = true -- Change manual
  3073.         local MainList = Instance.new("ScrollingFrame", ScriptList)
  3074.         MainList.Name = "Entries"
  3075.         MainList.BackgroundTransparency = 1
  3076.         MainList.BorderSizePixel = 0
  3077.         MainList.BottomImage = "rbxasset://textures/ui/Scroll/scroll-bottom.png"
  3078.         MainList.ClipsDescendants = true
  3079.         MainList.MidImage = "rbxasset://textures/ui/Scroll/scroll-middle.png"
  3080.         MainList.Position = UDim2.new(0, 0, 0, 5)
  3081.         MainList.ScrollBarThickness = 0 -- Change manual
  3082.         MainList.ScrollingDirection = Enum.ScrollingDirection.Y
  3083.         MainList.ScrollingEnabled = true
  3084.         MainList.Selectable = true
  3085.         MainList.Size = UDim2.new(1, 0, 1, -5)
  3086.         MainList.TopImage = "rbxasset://textures/ui/Scroll/scroll-top.png"
  3087.         do
  3088.             local ExampleText = Instance.new("TextButton", MainList)
  3089.             ExampleText.Name = "Script"
  3090.             ExampleText.BackgroundTransparency = 1
  3091.             ExampleText.Font = "Arial"
  3092.             ExampleText.FontSize = "Size14"
  3093.             ExampleText.Modal = false
  3094.             ExampleText.Position = UDim2.new() -- Change manual
  3095.             ExampleText.Selectable = true
  3096.             ExampleText.Size = UDim2.new(1, 0, 0, 14)
  3097.             ExampleText.Text = "ExampleScript"
  3098.             ExampleText.TextColor3 = Color3.fromRGB(255, 255, 255)
  3099.             ExampleText.TextScaled = true
  3100.             ExampleText.TextStrokeTransparency = 1
  3101.             ExampleText.TextWrapped = true
  3102.             ExampleText.TextXAlignment = "Center"
  3103.             ExampleText.TextYAlignment = "Center"
  3104.             ExampleText.Visible = false -- Change manual
  3105.         end
  3106.     end
  3107.     local Output = Instance.new("Frame", MainFrame)
  3108.     Output.Name = "Output"
  3109.     Output.BackgroundColor3 = Color3.fromRGB(6, 6, 6)
  3110.     Output.BackgroundTransparency = 0.2
  3111.     Output.BorderSizePixel = 0
  3112.     Output.Position = UDim2.new(0, 85, 0, 30)
  3113.     Output.Size = UDim2.new(1, -85, 1, -30)
  3114.     do
  3115.         local Title = Instance.new("TextLabel", Output)
  3116.         Title.Name = "Header"
  3117.         Title.BackgroundTransparency = 1
  3118.         Title.Font = "SourceSans"
  3119.         Title.FontSize = "Size24"
  3120.         Title.Position = UDim2.new(0, 2, 0, -32)
  3121.         Title.Size = UDim2.new(1, 0, 0, 24)
  3122.         Title.Text = "Output"
  3123.         Title.TextColor3 = Color3.fromRGB(255, 255, 255)
  3124.         Title.TextStrokeTransparency = 1
  3125.         Title.TextXAlignment = "Left"
  3126.         Title.TextYAlignment = "Top"
  3127.         do
  3128.             local FPS = Instance.new("TextLabel", Title)
  3129.             FPS.Name = "FPS"
  3130.             FPS.BackgroundTransparency = 1
  3131.             FPS.Font = "Arial"
  3132.             FPS.FontSize = "Size14"
  3133.             FPS.Position = UDim2.new(0, 77, 0, 7)
  3134.             FPS.Size = UDim2.new(0, 200, 0, 18)
  3135.             FPS.Text = "FPS: 60" -- Change manual
  3136.             FPS.TextColor3 = Color3.fromRGB(255, 255, 255)
  3137.             FPS.TextStrokeTransparency = 1
  3138.             FPS.TextXAlignment = "Left"
  3139.             FPS.TextYAlignment = "Top"
  3140.             local Line = Instance.new("Frame", Title)
  3141.             Line.Name = "Line"
  3142.             Line.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  3143.             Line.BackgroundTransparency = 0.8
  3144.             Line.BorderSizePixel = 0
  3145.             Line.Position = UDim2.new(0, 72, 0, 7)
  3146.             Line.Size = UDim2.new(0, 1, 0, 15)
  3147.             Line.ZIndex = 2
  3148.         end
  3149.         local Line = Instance.new("Frame", Output)
  3150.         Line.Name = "Line"
  3151.         Line.BackgroundColor3 = Color3.fromRGB(209, 209, 209)
  3152.         Line.BackgroundTransparency = 0.9
  3153.         Line.BorderSizePixel = 0
  3154.         Line.Position = UDim2.new(0, 0, 0, -4)
  3155.         Line.Size = UDim2.new(1, 0, 0, 1)
  3156.         Line.ZIndex = 2
  3157.         local Content = Instance.new("ScrollingFrame", Output)
  3158.         Content.Active = false
  3159.         Content.Name = "Entries"
  3160.         Content.BackgroundTransparency = 1
  3161.         Content.BorderSizePixel = 0
  3162.         Content.ClipsDescendants = true
  3163.         Content.Position = UDim2.new()
  3164.         Content.ScrollBarThickness = 5
  3165.         Content.ScrollingEnabled = true
  3166.         Content.Selectable = true
  3167.         Content.Size = UDim2.new(1, 0, 1, 0)
  3168.         local Template = Instance.new("TextButton", Output)
  3169.         Template.Active = false
  3170.         Template.Name = "Template"
  3171.         Template.BackgroundColor3 = Color3.fromRGB(255, 170, 0)
  3172.         Template.BackgroundTransparency = 1
  3173.         Template.Font = "Arial"
  3174.         Template.FontSize = "Size14"
  3175.         Template.Position = UDim2.new() -- Change manual
  3176.         Template.Selectable = true
  3177.         Template.Size = UDim2.new(1, 0, 0, 14)
  3178.         Template.Text = "13:56:44 - Welcome to oxcool1's Script Builder."
  3179.         Template.TextColor3 = Color3.fromRGB(255, 255, 255)
  3180.         Template.TextStrokeColor3 = Color3.fromRGB(255, 255, 255)
  3181.         Template.TextStrokeTransparency = 1
  3182.         Template.TextXAlignment = "Left"
  3183.         Template.TextYAlignment = "Center"
  3184.         Template.Visible = false
  3185.     end
  3186.     local Control = Instance.new("Frame", MainFrame)
  3187.     Control.Name = "Control"
  3188.     Control.BackgroundTransparency = 1
  3189.     Control.BorderSizePixel = 0
  3190.     Control.Position = UDim2.new()
  3191.     Control.Size = UDim2.new(1, 0, 0, 24)
  3192.     do
  3193.         local Exit = Instance.new("TextButton", Control)
  3194.         Exit.Name = "Exit"
  3195.         Exit.AutoButtonColor = true
  3196.         Exit.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  3197.         Exit.BackgroundTransparency = 0
  3198.         Exit.Font = "SourceSans"
  3199.         Exit.FontSize = "Size18"
  3200.         Exit.Position = UDim2.new(1, -26, 0, 0)
  3201.         Exit.Selectable = true
  3202.         Exit.Size = UDim2.new(0, 26, 1, 0)
  3203.         Exit.Style = "RobloxButton"
  3204.         Exit.Text = "X"
  3205.         Exit.TextColor3 = Color3.fromRGB(255, 255, 255)
  3206.         Exit.TextStrokeTransparency = 1
  3207.         Exit.ZIndex = 2
  3208.         local Clear = Instance.new("TextButton", Control)
  3209.         Clear.Name = "Clear"
  3210.         Clear.AutoButtonColor = true
  3211.         Clear.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  3212.         Clear.BackgroundTransparency = 0
  3213.         Clear.Font = "Arial"
  3214.         Clear.FontSize = "Size14"
  3215.         Clear.Position = UDim2.new(1, -74, 0, 0)
  3216.         Clear.Selectable = true
  3217.         Clear.Size = UDim2.new(0, 50, 1, 0)
  3218.         Clear.Style = "RobloxButton"
  3219.         Clear.Text = "Clear"
  3220.         Clear.TextColor3 = Color3.fromRGB(255, 255, 255)
  3221.         Clear.TextStrokeTransparency = 1
  3222.         Clear.ZIndex = 2
  3223.         local ToolMode = Instance.new("TextButton", Control)
  3224.         ToolMode.Name = "ToolMode"
  3225.         ToolMode.AutoButtonColor = true
  3226.         ToolMode.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  3227.         ToolMode.BackgroundTransparency = 0
  3228.         ToolMode.Font = "Arial"
  3229.         ToolMode.FontSize = "Size14"
  3230.         ToolMode.Position = UDim2.new(1, -149, 0, 0)
  3231.         ToolMode.Selectable = true
  3232.         ToolMode.Selected = false -- Change manual
  3233.         ToolMode.Size = UDim2.new(0, 77, 1, 0)
  3234.         ToolMode.Style = "RobloxButton"
  3235.         ToolMode.Text = "Tool Mode"
  3236.         ToolMode.TextColor3 = Color3.fromRGB(255, 255, 255)
  3237.         ToolMode.TextStrokeTransparency = 1
  3238.         ToolMode.ZIndex = 2
  3239.     end
  3240.     local Line = Instance.new("Frame", MainFrame)
  3241.     Line.Name = "Line"
  3242.     Line.BackgroundColor3 = Color3.fromRGB(209, 209, 209)
  3243.     Line.Transparency = 0.9
  3244.     Line.BorderSizePixel = 0
  3245.     Line.Position = UDim2.new(0, 82, 0, 0)
  3246.     Line.Size = UDim2.new(0, 1, 1, 0)
  3247.     Line.ZIndex = 2
  3248. end
  3249. local CommandBar = Instance.new("Frame", screen)
  3250. CommandBar.Name = "CommandBar"
  3251. CommandBar.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  3252. CommandBar.Transparency = 0
  3253. CommandBar.Position = UDim2.new(0, 65, 1, -35)
  3254. CommandBar.Size = UDim2.new(0, 400, 0, 30)
  3255. CommandBar.Style = "DropShadow"
  3256. do
  3257.     local Open = Instance.new("TextButton", CommandBar)
  3258.     Open.Name = "Open"
  3259.     Open.Active = true
  3260.     Open.AutoButtonColor = true
  3261.     Open.BackgroundColor3 = Color3.fromRGB(170, 255, 255)
  3262.     Open.BackgroundTransparency = 1
  3263.     Open.BorderSizePixel = 0
  3264.     Open.Font = "SourceSans"
  3265.     Open.FontSize = "Size14"
  3266.     Open.Position = UDim2.new(0, -3, 0, -3)
  3267.     Open.Size = UDim2.new(0, 75, 0, 20)
  3268.     Open.Text = "Close Output" -- Change manual
  3269.     Open.TextColor3 = Color3.fromRGB(255, 255, 255)
  3270.     Open.TextStrokeTransparency = 1
  3271.     local Line = Instance.new("Frame", CommandBar)
  3272.     Line.Name = "Line"
  3273.     Line.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  3274.     Line.BackgroundTransparency = 0.8
  3275.     Line.BorderSizePixel = 0
  3276.     Line.Position = UDim2.new(0, 75, 0, 0)
  3277.     Line.Size = UDim2.new(0, 1, 1, 0)
  3278.     Line.ZIndex = 2
  3279.     local Input = Instance.new("TextBox", CommandBar)
  3280.     Input.Name = "InputBar"
  3281.     Input.Active = true
  3282.     Input.BackgroundTransparency = 1
  3283.     Input.BorderSizePixel = 0
  3284.     Input.ClearTextOnFocus = true -- Yes?
  3285.     Input.Font = "SourceSans"
  3286.     Input.FontSize = "Size14"
  3287.     Input.MultiLine = false
  3288.     Input.Position = UDim2.new(0, 80, 0, -3)
  3289.     Input.Selectable = true
  3290.     Input.Size = UDim2.new(1, -77, 0, 20)
  3291.     Input.Text = "Click here or press (') to run a command" -- Change manual
  3292.     Input.TextColor3 = Color3.fromRGB(255, 255, 255)
  3293.     Input.TextStrokeTransparency = 1
  3294.     Input.TextXAlignment = "Left"
  3295.     Input.Visible = true
  3296. end
  3297. local Description = Instance.new("TextLabel", screen)
  3298. Description.Name = "Tip"
  3299. Description.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  3300. Description.BorderSizePixel = 0
  3301. Description.Font = "SourceSans"
  3302. Description.FontSize = "Size14"
  3303. Description.Position = UDim2.new() -- Change manual
  3304. Description.Size = UDim2.new(0, 53, 0, 16)
  3305. Description.Text = "Example"
  3306. Description.TextColor3 = Color3.fromRGB(255, 255, 255)
  3307. Description.TextStrokeTransparency = 1
  3308. Description.ZIndex = 2
  3309. Description.Visible = false -- Change manual
  3310. local oof = Instance.new("TextLabel", screen)
  3311. oof.Active = false
  3312. oof.BackgroundTransparency = 1
  3313. oof.Font = "SourceSansBold"
  3314. oof.FontSize = "Size36"
  3315. oof.Name = "Oof"
  3316. oof.Position = UDim2.new(0.2, 0, 0, -27)
  3317. oof.Size = UDim2.new(0, 100, 0, 15)
  3318. oof.Text = "Place1 ("..getServerType()..")"
  3319. oof.TextColor3 = Color3.fromRGB(255, 255, 255)
  3320. oof.TextStrokeColor3 = Color3.fromRGB(0, 0, 0)
  3321. oof.TextStrokeTransparency = 0
  3322. oof.ZIndex = -2147483648
  3323.  
  3324. function hookClient(player, justPlayerData)
  3325.     local playerData = dataBase[player.userId]
  3326.     if not playerData then
  3327.         playerData = {Player = player, SB = not justPlayerData, Quicks = {}, Scripts = {}, Saves = {}, Requires = {}, Close = emptyFunction}
  3328.         dataBase[player.userId] = playerData
  3329.         if Moderators[player.userId] then
  3330.             playerData.Mod = true
  3331.         end
  3332.     else
  3333.         playerData.Player = player
  3334.         playerData.Editing = nil
  3335.         playerData.SB = not justPlayerData
  3336.     end
  3337.    
  3338.     Routine(function()
  3339.         local saves = LoadString(player, saveKey)
  3340.         saves = saves ~= "" and http:JSONDecode(saves) or {}
  3341.         local scripts = {}
  3342.         for name, scriptData in pairs(playerData.Scripts) do
  3343.             local isSaved = toboolean(playerData.Saves[name])
  3344.             local savedData = saves[name]
  3345.             local deleted = false
  3346.             if savedData then
  3347.                 if (savedData.url) then
  3348.                     savedData.Source = "http:"..savedData.url
  3349.                     savedData.url = nil
  3350.                 end
  3351.                 scriptData.Source = savedData.Source
  3352.                 playerData.Saves[name] = savedData
  3353.             elseif isSaved then
  3354.                 disableScript(scriptData.Script)
  3355.                 playerData.Scripts[name] = nil
  3356.                 playerData.Saves[name] = nil
  3357.                 deleted = true
  3358.             end
  3359.             if not deleted then
  3360.                 table.insert(scripts, {(scriptData.Script and "Run" or "Normal"), name, isSaved})
  3361.             end
  3362.         end
  3363.         for name, savedData in pairs(saves) do
  3364.             if not playerData.Saves[name] then
  3365.                 if (savedData.url) then
  3366.                     savedData.Source = "http:" .. savedData.url
  3367.                     savedData.url = nil
  3368.                 end
  3369.                 playerData.Saves[name] = savedData
  3370.                 playerData.Scripts[name] = {Name = savedData.Name, Source = savedData.Source}
  3371.                 table.insert(scripts, {"Normal", savedData.Name, true})
  3372.             end
  3373.         end
  3374.         sendData(player, "Script", scripts)
  3375.     end)
  3376.    
  3377.     if justPlayerData then return end
  3378.     local OutputGui = screen:Clone()
  3379.     OutputGui.ResetOnSpawn = false
  3380.     OutputGui.Name = "SB_OutputGUI"
  3381.     OutputGui.Parent = player
  3382.     --Data Transfer
  3383.     local dataTransfer = Instance.new("Model")
  3384.     dataTransfer.Name = "SB_DataTransfer"
  3385.     local commandRemote = Instance.new("RemoteFunction", dataTransfer)
  3386.     commandRemote.Name = "SB_ReplicatorRemote"
  3387.     local numInput = 0
  3388.     commandRemote.OnServerInvoke = function(plr, num, text)
  3389.         if plr ~= player then return end
  3390.         if num == numInput or num == (numInput + 1) then
  3391.             numInput = num
  3392.             if type(text) == "string" and text ~= "" then
  3393.                 Pcall(SBInput, plr, "/e "..text, true)
  3394.             end
  3395.         end
  3396.     end
  3397.     local getLocalOwner = Instance.new("RemoteFunction", dataTransfer)
  3398.     getLocalOwner.Name = "SB_GetLocalOwner"
  3399.     getLocalOwner.OnServerInvoke = function(plr, script)
  3400.         return unpack(clientScripts[script])
  3401.     end
  3402.     local playerDataRemote = Instance.new("RemoteFunction", dataTransfer)
  3403.     playerDataRemote.Name = "SB_PlayerData"
  3404.     playerDataRemote.OnServerInvoke = function(plr)
  3405.         return dataBase[plr.userId]
  3406.     end
  3407.  
  3408.     local actionRemote = Instance.new("RemoteFunction", dataTransfer)
  3409.     actionRemote.Name = "SB_ActionRemote"
  3410.     playerData.dataTransfer = dataTransfer
  3411.     dataTransfer.Parent = player
  3412.  
  3413.     local ChatConnection = player.Chatted:Connect(function(msg)
  3414.         Pcall(SBInput, player, msg)
  3415.     end)
  3416.    
  3417.     local ticket = math.random(-2e5, 2e5)
  3418.     local isClosed = false
  3419.     if not playerData.Mod then
  3420.         playerData.Close = function(_, forced)
  3421.             local data = {
  3422.                 Ticket = ticket;
  3423.                 IsForced = forced;
  3424.                 Sent = numInput;
  3425.             }
  3426.             local rData = actionRemote:InvokeClient(player, encode("ClosureRequest"), data)
  3427.             if type(rData) == "table" and (rData.Sent == numInput or rData.Sent == numInput + 1) and rData.Ticket == (ticket * 2) and rData.Response == encode("AcceptedRequest") and not isClosed then
  3428.                 isClosed = true
  3429.                 playerData.Close = function() end
  3430.                 Members[plyr.UserId] = nil
  3431.                 ChatConnection:Disconnect()
  3432.                 dataTransfer:Destroy()
  3433.                 playerData.SB = false
  3434.                 warn(plyr.Name.." has been removed from the members of Script Builder")
  3435.             end
  3436.         end
  3437.     end
  3438.  
  3439.     --//LocalScript source ----------------------------------
  3440.  
  3441.     local PlayerGui = WaitForChildOfClass(player, "PlayerGui")
  3442.    
  3443.     local ProtectedGui = Instance.new("ScreenGui")
  3444.     ProtectedGui.ResetOnSpawn = false
  3445.     ProtectedGui.Name = http:GenerateGUID(false):gsub("-", "")
  3446.    
  3447.     CreateLocal(ClientManagerSource, ProtectedGui).Name = "ClientManager"
  3448.     local Source = [==[wait();script:Destroy()
  3449.     print("RUN START: OutputGui")
  3450.    
  3451.     local player = game:GetService("Players").LocalPlayer
  3452.     local playerGui = player:findFirstChildOfClass("PlayerGui")
  3453.     local TweenService = game:GetService("TweenService")
  3454.     local UIS = game:GetService("UserInputService")
  3455.     local mouse = player:GetMouse()
  3456.     local dataTransfer = player:WaitForChild("SB_DataTransfer")
  3457.     local commandRemote = dataTransfer:WaitForChild("SB_ReplicatorRemote")
  3458.     local actionRemote = dataTransfer:WaitForChild("SB_ActionRemote")
  3459.     local playerData = dataTransfer:WaitForChild("SB_PlayerData"):InvokeServer()
  3460.    
  3461.     local OutputGUI = player:WaitForChild("SB_OutputGUI"):Clone()
  3462.     player.SB_OutputGUI:Destroy()
  3463.    
  3464.     local fakeInf = tonumber(string.rep(9, 30))
  3465.     local numFired = 0
  3466.     local outputDebounce = 0
  3467.     local Connections = {}
  3468.     local StopOutput = false
  3469.  
  3470.     local scriptColors = {
  3471.         Normal = Color3.new(1, 1, 1),
  3472.         Edit = Color3.new(1, 0.6, 0.4),
  3473.         Run = Color3.new(0, 1, 0)
  3474.     }
  3475.    
  3476.     local outputColors = {
  3477.         Note = Color3.new(0, 1, 0),
  3478.         Run = Color3.new(0.4, 0.5, 1),
  3479.         Error = Color3.new(1, 25/255, 25/255),
  3480.         Print = Color3.new(1, 1, 1),
  3481.         Warn = Color3.new(1, 0.6, 0.4),
  3482.         Info = Color3.new(102/255, 190/255, 1)
  3483.     }
  3484.    
  3485.     -------------------------------------------------------------
  3486.    
  3487.     local encode, decode
  3488.     do
  3489.         local Key53 = 8186484168865098
  3490.         local Key14 = 4887
  3491.         local inv256
  3492.         function encode(str)
  3493.             if not inv256 then
  3494.                 inv256 = {}
  3495.                 for M = 0, 127 do
  3496.                     local inv = -1
  3497.                     repeat inv = inv + 2
  3498.                     until inv * (2*M + 1) % 256 == 1
  3499.                     inv256[M] = inv
  3500.                 end
  3501.             end
  3502.             local K, F = Key53, 16384 + Key14
  3503.             return (str:gsub('.', function(m)
  3504.                 local L = K % 274877906944  -- 2^38
  3505.                 local H = (K - L) / 274877906944
  3506.                 local M = H % 128
  3507.                 m = m:byte()
  3508.                 local c = (m * inv256[M] - (H - M) / 128) % 256
  3509.                 K = L * F + H + c + m
  3510.                 return ('%02x'):format(c)
  3511.             end))
  3512.         end
  3513.         function decode(str)
  3514.             local K, F = Key53, 16384 + Key14
  3515.             return (str:gsub('%x%x', function(c)
  3516.                 local L = K % 274877906944  -- 2^38
  3517.                 local H = (K - L) / 274877906944
  3518.                 local M = H % 128
  3519.                 c = tonumber(c, 16)
  3520.                 local m = (c + (H - M) / 128) * (2*M + 1) % 256
  3521.                 K = L * F + H + c + m
  3522.                 return string.char(m)
  3523.             end))
  3524.         end
  3525.     end
  3526.    
  3527.     local function getTime()
  3528.         local sec = tick()
  3529.         return ("%.2d:%.2d:%.2d"):format(sec/3600%24, sec/60%60, sec%60)
  3530.     end
  3531.    
  3532.     local function newThread(func)
  3533.         coroutine.resume(coroutine.create(func))
  3534.     end
  3535.  
  3536.     local function sendNotification(info)
  3537.         return game:GetService("StarterGui"):SetCore("SendNotification", info)
  3538.     end
  3539.  
  3540.     local function ScrollSystem(listFrame)
  3541.         local scroll = {
  3542.             X={
  3543.                 Index = 0,
  3544.                 Size = 0,
  3545.                 viewSize = listFrame.AbsoluteSize.x
  3546.             },
  3547.             Y = {
  3548.                 Index = 0,
  3549.                 Size = 0,
  3550.                 viewSize = listFrame.AbsoluteSize.y
  3551.             }
  3552.         }
  3553.         local function updateScroll(_, x, y, sizeX, sizeY)
  3554.             scroll.X.Index = x or listFrame.CanvasPosition.X
  3555.             scroll.X.Size = sizeX or listFrame.CanvasSize.X.Offset
  3556.             scroll.Y.Index = y or listFrame.CanvasPosition.Y
  3557.             scroll.Y.Size = sizeY or listFrame.CanvasSize.Y.Offset
  3558.             listFrame.CanvasSize = UDim2.new(0, sizeX or scroll.X.Size, 0, sizeY or scroll.Y.Size)
  3559.             listFrame.CanvasPosition = Vector2.new(x or scroll.X.Index, y or scroll.Y.Index)
  3560.         end
  3561.         return {updateScroll = updateScroll, scrollingFrame = listFrame, X = scroll.X, Y = scroll.Y}
  3562.     end
  3563.  
  3564.     -------------------------------------------------------------
  3565.  
  3566.     local Scripts = {}
  3567.     local Output = {{"Note", getTime() .. " - Welcome to Voidacity's Script Builder. Please don't abuse. Enjoy!"}}
  3568.     local scriptScroll
  3569.     local outputScroll
  3570.     local inputBar
  3571.     local lastMouseTexture
  3572.     local SB_OutputGui = nil
  3573.     local isFirst = true
  3574.     local lastChange = tick()
  3575.  
  3576.     function createOutputGUI(scriptIndex, outputIndex, visible, toolmode)
  3577.         local RbxEvents = {}
  3578.         local function RbxEvent(signal, func)
  3579.             local event = signal:Connect(func)
  3580.             table.insert(RbxEvents, event)
  3581.             return event
  3582.         end
  3583.         local outputGui = OutputGUI:Clone()
  3584.         SB_OutputGui = outputGui
  3585.         outputGui.Parent = player:WaitForChild("PlayerGui")
  3586.         local mainFrame = outputGui.Main
  3587.         local taskFrame = outputGui.CommandBar
  3588.         local tip = outputGui.Tip
  3589.         local scriptFrame = mainFrame.ScriptList
  3590.         local outputFrame = mainFrame.Output
  3591.         local controlFrame = mainFrame.Control
  3592.         -- TaskFrame
  3593.         local openButton = taskFrame.Open
  3594.         inputBar = taskFrame.InputBar
  3595.         local defY = - (35 + mainFrame.AbsoluteSize.Y) -- in vsb 35
  3596.         local toolDefY = - (100 + mainFrame.AbsoluteSize.Y) -- in vsb 100
  3597.         local defOpenedX = 6 -- in vsb 6
  3598.         local defClosedX = - (50 + mainFrame.AbsoluteSize.X) -- in vsb same (50)
  3599.         mainFrame.Changed:Connect(function(prop)
  3600.             if prop == "Size" or prop == "Position" then
  3601.                 defY = - (35 + mainFrame.AbsoluteSize.Y)
  3602.                 toolDefY = - (100 + mainFrame.AbsoluteSize.Y)
  3603.                 defOpenedX = 6
  3604.                 defClosedX = - (50 + mainFrame.AbsoluteSize.X)
  3605.             end
  3606.         end)
  3607.         RbxEvent(openButton.MouseButton1Up, function()
  3608.             if not visible then
  3609.                 visible = true
  3610.                 openButton.Text = "Close Output"
  3611.                 mainFrame:TweenPosition(UDim2.new(0, defOpenedX, 1, (toolmode and toolDefY or defY)), "Out", nil, 0.3, true)
  3612.             else
  3613.                 visible = false
  3614.                 openButton.Text = "Open Output"
  3615.                 mainFrame:TweenPosition(UDim2.new(0, defClosedX, 1, defY), "Out", nil, 0.3, true)  
  3616.             end
  3617.         end)
  3618.         RbxEvent(inputBar.FocusLost, function(enter, input)
  3619.             if enter and input and input.KeyCode == Enum.KeyCode.Return then
  3620.                 numFired = numFired + 1
  3621.                 local focused = false
  3622.                 newThread(function()
  3623.                     inputBar.Focused:Wait()
  3624.                     focused = true
  3625.                 end)
  3626.                 commandRemote:InvokeServer(numFired, inputBar.Text)
  3627.                 if not focused then
  3628.                     inputBar.Text = "Click here or press (') to run a command"
  3629.                 end
  3630.             end
  3631.         end)
  3632.         -- ScriptFrame
  3633.         local scriptEntries = {}
  3634.         local scriptList = scriptFrame.Entries
  3635.         local scriptTemplate = scriptList.Script
  3636.         local scriptMessage = scriptFrame.Message
  3637.         local lastEntry;
  3638.         scriptScroll = ScrollSystem(scriptList)
  3639.         scriptScroll.Update = function(_, x, y)
  3640.             local maxY = 0
  3641.             for i, data in ipairs(Scripts) do
  3642.                 local type, name, isSaved = unpack(data)
  3643.                 local color = scriptColors[type]
  3644.                 local entry = scriptEntries[i] or scriptTemplate:Clone()
  3645.                 entry.Name = "Script"
  3646.                 entry.Parent = scriptList
  3647.                 entry.Text = (isSaved and "(" .. name .. ")" or name)
  3648.                 entry.TextColor3 = color
  3649.                 entry.Size = UDim2.new(1, 0, 0, 14)
  3650.                 entry.Position = UDim2.new(0, 0, 0, maxY)
  3651.                 entry.Visible = true
  3652.                 if not scriptEntries[i] then
  3653.                     RbxEvent(entry.MouseEnter, function(x, y)
  3654.                         lastEntry = entry
  3655.                         tip.Text = entry.Text
  3656.                         tip.Size = UDim2.new(0, tip.TextBounds.X + 30, 0, 16)
  3657.                         tip.Position = UDim2.new(0, x, 0, y-14)
  3658.                         tip.Visible = true
  3659.                         local con = RbxEvent(entry.MouseMoved, function(x, y)
  3660.                             tip.Position = UDim2.new(0, x, 0, y-14)
  3661.                         end)
  3662.                         entry.MouseLeave:wait()
  3663.                         con:disconnect()
  3664.                         if lastEntry == entry then
  3665.                             tip.Visible = false
  3666.                         end
  3667.                     end)
  3668.                 end
  3669.                 maxY = maxY + entry.AbsoluteSize.y + 0
  3670.                 scriptEntries[i] = entry
  3671.             end
  3672.             scriptScroll:updateScroll(x, y, scriptList.AbsoluteSize.X, maxY)
  3673.             scriptMessage.Visible = (#Scripts == 0)
  3674.         end
  3675.         scriptScroll.Add = function(_, script, location)
  3676.             for i, tab in ipairs(Scripts) do
  3677.                 if tab[2] == script[2] then
  3678.                     table.remove(Scripts, i)
  3679.                     break
  3680.                 end
  3681.             end
  3682.             table.insert(Scripts, location, script)
  3683.         end
  3684.         scriptScroll.Remove = function(_, name)
  3685.             for i, tab in ipairs(Scripts) do
  3686.                 if tab[2] == name then
  3687.                     table.remove(Scripts, i)
  3688.                     table.remove(scriptEntries, i):Destroy()
  3689.                     break
  3690.                 end
  3691.             end
  3692.         end
  3693.         scriptScroll:Update(0, fakeInf)
  3694.         scriptList.MouseEnter:Connect(function()
  3695.             scriptList.ScrollBarThickness = 6
  3696.         end)
  3697.         scriptList.MouseLeave:Connect(function()
  3698.             scriptList.ScrollBarThickness = 0
  3699.         end)
  3700.         -- OutputFrame
  3701.         local outputEntries = {}
  3702.         local outputHeader = outputFrame.Header
  3703.         local outputList = outputFrame.Entries
  3704.         _G.main = outputList
  3705.         local outputTemplate = outputFrame.Template
  3706.         outputScroll = ScrollSystem(outputList)
  3707.         outputScroll.Update = function(_, x, y)
  3708.             local reNum = outputDebounce
  3709.             local maxX, maxY = 0, 0
  3710.             for i, data in ipairs(Output) do
  3711.                 if reNum ~= outputDebounce then break end
  3712.                 local type, text = unpack(data)
  3713.                 local entry = outputEntries[i] or outputTemplate:clone()
  3714.                 entry.Name = "OutputText"
  3715.                 entry.Parent = outputList
  3716.                 entry.Text = text
  3717.                 entry.TextColor3 = outputColors[type]
  3718.                 entry.Size = UDim2.new(0, entry.TextBounds.x, 0, entry.TextBounds.y)
  3719.                 entry.Position = UDim2.new(0, 2, 0, maxY)
  3720.                 entry.Visible = true
  3721.                 maxX = math.max(maxX, entry.AbsoluteSize.x + 5)
  3722.                 maxY = maxY + entry.AbsoluteSize.y + 2
  3723.                 outputEntries[i] = entry
  3724.                 if reNum ~= outputDebounce then break end
  3725.             end
  3726.             local scroll = outputScroll.scrollingFrame
  3727.             local y = (maxY >= scroll.AbsoluteWindowSize.Y and y or scroll.CanvasPosition.Y)
  3728.             outputScroll:updateScroll(x, y, maxX, maxY)
  3729.         end
  3730.         outputScroll:Update(outputIndex.x, outputIndex.y)
  3731.         newThread(function()
  3732.             while outputGui.Parent do
  3733.                 outputHeader.FPS.Text = "FPS: " .. ("%05.2f"):format(workspace:GetRealPhysicsFPS())
  3734.                 wait(0.1)
  3735.             end
  3736.         end)
  3737.         -- Settings
  3738.         local clear = controlFrame.Clear
  3739.         local toolMode = controlFrame.ToolMode
  3740.         local exit = controlFrame.Exit
  3741.         RbxEvent(clear.MouseButton1Up, function()
  3742.             for i = 1, #Output do
  3743.                 table.remove(Output, 1)
  3744.                 table.remove(outputEntries, 1):Destroy()
  3745.             end
  3746.             outputScroll:Update()
  3747.         end)
  3748.         RbxEvent(toolMode.MouseButton1Up, function()
  3749.             if toolmode then
  3750.                 toolmode = false
  3751.                 toolMode.Selected = false
  3752.                 mainFrame:TweenPosition(UDim2.new(0, defOpenedX, 1, defY), "Out", nil, 0.3, true)
  3753.             else
  3754.                 toolmode = true
  3755.                 toolMode.Selected = true
  3756.                 mainFrame:TweenPosition(UDim2.new(0, defOpenedX, 1, toolDefY), "Out", nil, 0.3, true)
  3757.             end
  3758.         end)
  3759.         RbxEvent(exit.MouseButton1Up, function()
  3760.             visible = false
  3761.             openButton.Text = "Open Output"
  3762.             mainFrame:TweenPosition(UDim2.new(0, defClosedX, 1, defY), "Out", nil, 0.3, true)
  3763.         end)
  3764.  
  3765.         if isFirst then
  3766.             isFirst = false
  3767.             mainFrame.Position = UDim2.new(0, -600, 1, -206)
  3768.         else
  3769.             mainFrame.Position = UDim2.new(0, (visible and defOpenedX or defClosedX), 1, (toolmode and visible and toolDefY or defY))
  3770.         end
  3771.         openButton.Text = (visible and "Close" or "Open") .. " Output"
  3772.         toolMode.Selected = not not toolmode
  3773.  
  3774.         --//Resizable code
  3775.         local aroundDrag, pressing;
  3776.         local topMouseTexture = "rbxassetid://1195128791"
  3777.         local rightMouseTexture = "rbxassetid://1243635772"
  3778.         lastMouseTexture = mouse.Icon
  3779.         local minY = 106 -- in size
  3780.         local maxY = 391 -- in size
  3781.         local minX = 320 -- in size
  3782.         local maxX = 900 -- in size
  3783.         local function uiTyp(input)
  3784.             return input.UserInputType == Enum.UserInputType.MouseButton1
  3785.         end
  3786.         RbxEvent(mouse.Changed, function(prop)
  3787.             if prop == "Icon" and not aroundDrag then
  3788.                 lastMouseTexture = mouse.Icon
  3789.             end
  3790.         end)
  3791.         RbxEvent(mouse.Move, function()
  3792.             local x, y = mouse.X, mouse.Y
  3793.             local absPos, absSize = mainFrame.AbsolutePosition, mainFrame.AbsoluteSize
  3794.             if pressing == "Top" then
  3795.                 local sizeY = absSize.Y
  3796.                 local posY = absPos.Y
  3797.                 local maxPos, minPos = posY - (maxY - sizeY), posY + (sizeY - minY)
  3798.                 local resultY = math.min(math.max(y, maxPos), minPos)
  3799.                 local magnitude = posY - resultY
  3800.                 mainFrame.Position = UDim2.new(0, absPos.X, 0, resultY)
  3801.                 mainFrame.Size = UDim2.new(0, absSize.X, 0, sizeY + magnitude, maxY)
  3802.                 scriptScroll:Update(0, fakeInf)
  3803.             elseif pressing == "Right" then
  3804.                 local sizeX = absSize.X
  3805.                 local posX = absPos.X
  3806.                 local result = math.min(math.max(x - posX, minX), maxX)
  3807.                 mainFrame.Size = UDim2.new(0, result, 0, absSize.Y)
  3808.                 scriptScroll:Update(0, fakeInf)
  3809.             end
  3810.         end)
  3811.         RbxEvent(game:GetService("RunService").Stepped, function()
  3812.             local x, y = mouse.X, mouse.Y
  3813.             local absPos, absSize = mainFrame.AbsolutePosition, mainFrame.AbsoluteSize
  3814.             local dist = 3
  3815.             if (x <= (absPos.X + absSize.X + dist) and x >= (absPos.X + absSize.X - dist)) and (y >= absPos.Y and y <= (absPos.Y + absSize.Y)) then
  3816.                 -- Right dragging
  3817.                 aroundDrag = "Right"
  3818.                 mouse.Icon = rightMouseTexture
  3819.             elseif (y <= (absPos.Y + dist) and y >= (absPos.Y - dist)) and (x >= absPos.X and x <= (absPos.X + absSize.X)) then
  3820.                 -- Top dragging
  3821.                 aroundDrag = "Top"
  3822.                 mouse.Icon = topMouseTexture
  3823.             else
  3824.                 aroundDrag = nil
  3825.                 mouse.Icon = lastMouseTexture
  3826.             end
  3827.         end)
  3828.         RbxEvent(UIS.InputBegan, function(input)
  3829.             if uiTyp(input) then
  3830.                 pressing = aroundDrag
  3831.             end
  3832.         end)
  3833.         RbxEvent(UIS.InputEnded, function(input)
  3834.             if uiTyp(input) then
  3835.                 pressing = nil
  3836.             end
  3837.         end)
  3838.        
  3839.         local guiconn; guiconn = outputGui.Changed:Connect(function(prop)
  3840.             if prop == "Parent" then
  3841.                 guiconn:Disconnect()
  3842.                 spawn(function()
  3843.                     outputGui:Destroy()
  3844.                 end)
  3845.                 for i, v in pairs(RbxEvents) do
  3846.                     v:Disconnect()
  3847.                 end
  3848.                 mouse.Icon = lastMouseTexture
  3849.                 if not StopOutput then
  3850.                     if tick() - lastChange < 1 then
  3851.                         wait(0.1)
  3852.                     end
  3853.                     createOutputGUI({x=0, y=0}, {x=outputScroll.scrollingFrame.CanvasPosition.X, y=outputScroll.scrollingFrame.CanvasPosition.Y}, visible, toolmode)
  3854.                     lastChange = tick()
  3855.                     warn("The output has been replaced. (The previous one was probably destroyed)")
  3856.                     if not playerData.Mod and not warned then
  3857.                         warned = true
  3858.                         warn("WARNING: If you don't want to use vsb anymore use the \"g/exit\" command on your command bar.")
  3859.                     end
  3860.                 end
  3861.             end
  3862.         end)
  3863.     end
  3864.  
  3865.     createOutputGUI({x=0, y=0}, {x=0, y=0})
  3866.  
  3867.     -----------------------------------------------------
  3868.  
  3869.     local http = game:GetService("HttpService")
  3870.  
  3871.     function getData(child)
  3872.         if child:IsA("StringValue") and child.Name:match("^SB_Output:") then
  3873.             local type = child.Name:match("SB_Output:(%w+)")
  3874.             local data = http:JSONDecode(child.Value)
  3875.             if type == "Script" then
  3876.                 for i, tab in ipairs(data) do
  3877.                     scriptScroll:Add(tab, 1)
  3878.                 end
  3879.                 scriptScroll:Update(0, fakeInf)
  3880.             elseif type == "Quick" then
  3881.                 for i, name in ipairs(data) do
  3882.                     scriptScroll:Add({"Normal", name}, #Scripts+1)
  3883.                 end
  3884.                 scriptScroll:Update(0, fakeInf)
  3885.             elseif type == "RemoveScript" then
  3886.                 for i, name in ipairs(data) do
  3887.                     scriptScroll:Remove(name)
  3888.                 end
  3889.                 scriptScroll:Update(0, fakeInf)
  3890.             elseif type == "Output" then
  3891.                 outputDebounce = outputDebounce + 1
  3892.                 if #Output == 1000 then
  3893.                     table.remove(Output, 1)
  3894.                 end
  3895.                 local type, text, stack = unpack(data)
  3896.                 if type == "Print" then
  3897.                     table.insert(Output, {"Print", "> " .. text:gsub("\n", "\n  ")})
  3898.                 else
  3899.                     local prefix = getTime() .. " - "
  3900.                     table.insert(Output, {type, prefix .. text:gsub("\n", "\n ") .. (stack or ""):gsub("\n", "\n"..prefix)})
  3901.                 end
  3902.                 local scroll = outputScroll.scrollingFrame
  3903.                 local offset = scroll.CanvasSize.Y.Offset
  3904.                 if ((offset - scroll.CanvasPosition.Y) <= (scroll.AbsoluteWindowSize.Y + 10)) then
  3905.                     outputScroll:Update(scroll.CanvasPosition.X, fakeInf);
  3906.                 else
  3907.                     outputScroll:Update();
  3908.                 end
  3909.             end
  3910.             wait();
  3911.             child:Destroy()
  3912.         end
  3913.     end
  3914.  
  3915.     table.insert(Connections, player.ChildAdded:Connect(function(child) pcall(getData, child) end))
  3916.  
  3917.     for i, child in pairs(player:GetChildren()) do
  3918.         pcall(getData, child)
  3919.     end
  3920.  
  3921.     Connections[#Connections + 1] = mouse.KeyDown:Connect(function(key)
  3922.         if key == "'" then
  3923.             inputBar:CaptureFocus()
  3924.         end
  3925.     end)
  3926.  
  3927.     local isClosed = false
  3928.     local closureDb = false
  3929.  
  3930.     if not playerData.Mod then
  3931.         local function deleteAll(t)
  3932.             isClosed = true
  3933.             for i, v in pairs(Connections) do
  3934.                 v:Disconnect()
  3935.             end
  3936.             StopOutput = true
  3937.             if SB_OutputGui then
  3938.                 SB_OutputGui:Destroy()
  3939.             end
  3940.             return {Sent = numFired; Ticket = t; Response = encode("AcceptedRequest")}
  3941.         end
  3942.         actionRemote.OnClientInvoke = function(act, data)
  3943.             if act == encode("ClosureRequest") and type(data) == "table" and data.Sent == numFired and not isClosed then
  3944.                 if closureDb then return end
  3945.                 closureDb = true
  3946.                 local t = data.Ticket * 2
  3947.                 if data.IsForced then
  3948.                     closureDb = false
  3949.                     return deleteAll(t)
  3950.                 else
  3951.                     local init = tick()
  3952.                     local responsed = false
  3953.                     local rData
  3954.                     local bindable = Instance.new("BindableFunction")
  3955.                     bindable.OnInvoke = function(response)
  3956.                         if response == "Accept" then
  3957.                             rData = deleteAll(t)
  3958.                             responsed = true
  3959.                         end
  3960.                     end
  3961.                     sendNotification({
  3962.                         Title = "Closure request";
  3963.                         Text = "You won't have access to vsb commands unless a moderator gives it to you.";
  3964.                         Duration = 15;
  3965.                         Button1 = "Accept";
  3966.                         Button2 = "Decline";
  3967.                         Callback = bindable;
  3968.                     })
  3969.                     repeat wait() until responsed or tick()-init > 15
  3970.                     closureDb = false
  3971.                     return rData
  3972.                 end
  3973.             end
  3974.         end
  3975.     end
  3976.    
  3977.     sendNotification({
  3978.         Title = "Welcome to Script Builder";
  3979.         Text = "You have access to the commands. Don't abuse, enjoy!";
  3980.         Duration = 10;
  3981.         Button1 = "Accept";
  3982.         --Icon = "rbxassetid://2514057241";
  3983.     })
  3984.    
  3985.    
  3986.     print("OUTPUTGUI RUNNING")
  3987.     ]==]
  3988.     CreateLocal(Source, ProtectedGui).Name = "SB_OutputGUIScript"
  3989.     ProtectedGui.Parent = PlayerGui
  3990. end
  3991.  
  3992. local function setupPlayer(plr)
  3993.     if Members[plr.UserId] or Moderators[plr.UserId] or EAenabled then
  3994.         hookClient(plr)
  3995.     else
  3996.         hookClient(plr, true)
  3997.     end
  3998. end
  3999.  
  4000. OnPlayerAdded(function(player)
  4001.     coroutine.wrap(setupPlayer)(player)
  4002.     local ind = tostring(player.UserId)
  4003.     local banData = banList[ind]
  4004.     local gBanData = gBanList[ind]
  4005.     local isBanned = false
  4006.     if gBanData then
  4007.         local timeLeftInDays = gBanData.Duration - math.floor((os.time()-gBanData.Timestamp)/86400)
  4008.         if timeLeftInDays <= 0 or Moderators[player.UserId] then
  4009.             RemoveGlobalBan(ind)
  4010.         else
  4011.             player:Kick("Banned by: "..gBanData.BannedBy.." - Ban type: Game - Days left: "..timeLeftInDays.." - Reason: "..gBanData.Reason)
  4012.             isBanned = true
  4013.         end
  4014.     elseif banData then
  4015.         player:Kick("Banned by: "..banData.BannedBy.." - Ban type: Server - Reason: "..tostring(banData.Reason))
  4016.         isBanned = true
  4017.     end
  4018.     if isBanned then
  4019.         for i, plyr in pairs(players:GetPlayers()) do
  4020.             if plyr ~= player then
  4021.                 sendData(plyr, "Output", {"Note", player.Name.." is banned from the server"})
  4022.             end
  4023.         end
  4024.     end
  4025. end)
  4026.  
  4027. players.PlayerAdded:Connect(function(player)
  4028.     for i, plyr in pairs(players:GetPlayers()) do
  4029.         if plyr ~= player then
  4030.             sendData(plyr, "Output", {"Note", player.Name.." has joined the server"})
  4031.         end
  4032.     end
  4033. end)
  4034.  
  4035. players.PlayerRemoving:Connect(function(player)
  4036.     dataBase[player.UserId].SB = false
  4037.     for i, plyr in pairs(players:GetPlayers()) do
  4038.         if plyr ~= player then
  4039.             sendData(plyr, "Output", {"Note", player.Name.." has left the server"})
  4040.         end
  4041.     end
  4042. end)
Add Comment
Please, Sign In to add comment