User:NXTBoy/Scripts/ G Fix
From Legacy Roblox Wiki
< User:NXTBoy | Scripts
local fixed = {} --Add globals function copyKeys(from, keys, to) --Copy keys `keys` from `from` into `to` (or an empty table), and return it t = {} or to for _, key in pairs(keys) do t[key] = from[key] end return t end do --fix pseudo-tables _G.string = copyKeys(string, { "byte", "char", "dump", "find", "format", "gmatch", "gsub", "len", "lower", "match", "rep", "reverse", "sub", "upper" }) _G.math = copyKeys(math, { "abs", "acos", "asin", "atan", "atan2", "ceil", "cos", "cosh", "deg", "exp", "floor", "fmod", "frexp", "huge", "ldexp", "log", "log10", "max", "min", "modf", "pi", "pow", "rad", "random", "randomseed", "sin", "sinh", "sqrt", "tan", "tanh" }) _G.table = copyKeys(table, { "concat", "foreach", "foreachi", "getn", "insert", "maxn", "remove", "setn", "sort" }) _G.coroutine = copyKeys(coroutine, { "create", "resume", "running", "status", "wrap", "yield" }) --variables --variables copyKeys(env, { "assert", "delay", "dofile", "error", "_G", "game", "workspace", "gcinfo", "getfenv", "getmetatable", "ipairs", "load", "loadfile", "loadstring", "next", "newproxy", "pairs", "pcall", "print", "rawequal", "rawget", "rawset", "select", "setfenv", "setmetatable", "Spawn", "tick", "time", "tonumber", "tostring", "type", "unpack", "_VERSION", "wait", "xpcall" }, _G) --Classes copyKeys(env, { "Instance", "BrickColor", "Color3", "CFrame", "Enum", "Ray", "UDim", "UDim2", "Vector2", "Vector3" }, _G) --This annoys me _G.spawn = _G.Spawn end setmetatable(_G, { __index = function(t, k) if k == "isFixed" or k == "is_fixed" or k == "fixed" then local env = getfenv(2) if not fixed[env] then newEnv = {} for k, v in pairs(env) do if not _G[k] then newEnv[k] = v end end setmetatable(newEnv, { __index = _G, __newindex = _G }) setfenv(2, newEnv) fixed[newEnv] = true end return true end end })