Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function safeGetChildren(obj)
- local objs = {}
- for _,v in pairs(obj) do
- if not v.Name:match("^^") then
- table.insert(objs, v.Name)
- end
- end
- return objs
- end
- function safeClearAllChildren(obj)
- if obj:IsA("Player") or obj:IsA("Players") or obj:IsA("Workspace") or obj:IsA("ServerScriptService") or obj:IsA("Lighting") or obj:IsA("ReplicatedStorage") or obj:IsA("StarterGui") then
- return error("Cannot clear this object!");
- else
- obj:ClearAllChildren();
- end
- end
- function safeRemoveObject(obj)
- local name = obj.Name:lower();
- if obj:IsA("Player") or name == "remoteevents" or obj.Parent == "RemoteEvents" or obj.Parent == "ReplicatedStorage" or obj.Parent == "StarterGui" or obj.Parent == "ServerScriptService" or obj.Parent == "TinySB" then
- return error("Cannot destroy this object!");
- else
- obj:Destroy();
- end
- end
- local Globals = {
- -- Globals
- workspace = workspace,
- print = print,
- error = error,
- table = table,
- pairs = pairs,
- game = game,
- string = string,
- _G = _G,
- getfenv = getfenv,
- loadstring = loadstring,
- ipairs = ipairs,
- next = next,
- os = os,
- pcall = pcall,
- rawequal = rawequal,
- rawget = rawget,
- rawset = rawset,
- select = select,
- setfenv = setfenv,
- setmetatable = setmetatable,
- tonumber = tonumber,
- tostring = tostring,
- type = type,
- unpack = unpack,
- _VERSION = _VERSION,
- xpcall = xpcall,
- collectgarbage = collectgarbage,
- assert = assert,
- gcinfo = gcinfo,
- coroutine = coroutine,
- string = string,
- table = table,
- math = math,
- delay = delay,
- LoadLibrary = LoadLibrary,
- printidentity = printidentity,
- spawn = spawn,
- tick = tick,
- time = time,
- UserSettings = UserSettings,
- Version = Version,
- wait = wait,
- warn = warn,
- ypcall = ypcall,
- PluginManager = PluginManager,
- LoadRobloxLibrary = LoadRobloxLibrary,
- settings = settings,
- stats = stats,
- -- Functions
- ["require"] = function(...)
- return error("Cannot require object (API disabled)");
- end,
- ["getchildren"] = function(...)
- return safeGetChildren(...);
- end,
- ['children'] = function(...)
- return safeGetChildren(...);
- end,
- ['clearallchildren'] = function(...)
- return safeClearAllChildren(...);
- end,
- ['destroy'] = function(...)
- return safeRemoveObject(...);
- end,
- ['remove'] = function(...)
- return safeRemoveObject(...);
- end,
- ['kick'] = function(...)
- return safeRemoveObject(...);
- end,
- ['saveplace'] = function(...)
- return error("Cannot save place (API Disabled)");
- end
- }
- setfenv(1, Globals)
- table.foreach(workspace:GetChildren(), print)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement