
KeylessUniversal

--[[
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░|░░░░░░░░░░░░░░░░░░░░░░░░░|░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░█▀█░█░█░█▀▄░█▀▀░█░█░█▀█░█▀▀░░░█░█░▀█░░|░█▀▀░█▀▀░█▀▄░█▀▀░█▀▀░▀█▀░|░█▀▀░█▀▄░█▀█░█▀▀░▀▀█░█░█░█▀▀░▀█▀░█▀▀░█░█░█▀▀░▀█▀░▀█▀░
░█▀▀░█░█░█▀▄░█▀▀░█░█░█░█░█░░░░░▀▄▀░░█░░|░▀▀█░█▀▀░█▀▄░█░█░█▀▀░░█░░|░█░█░█▀▄░█░█░▀▀█░▄▀░░█░█░█░█░░█░░█░█░█▀▄░█▀▀░░█░░░█░░
░▀░░░▀▀▀░▀░▀░▀▀▀░▀▀▀░▀░▀░▀▀▀░░░░▀░░▀▀▀░|░▀▀▀░▀▀▀░▀░▀░▀▀▀░▀▀▀░▀▀▀░|░▀▀▀░▀░▀░▀▀▀░▀▀▀░▀▀▀░▀▀▀░▀▀▀░▀▀▀░▀▀▀░▀░▀░▀▀▀░▀▀▀░░▀░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░|░░░░░░░░░░░░░░░░░░░░░░░░░|░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-----------------------------------------------------------------------------------------------------------------------
PureUNC V1
By Sergei.dev & Mirabilitas
PureUNC is a compatibility layer that recreates unsupported UNC functions
in executable Luau to improve compatibility across executors.
Some functions are emulated and may not behave identically to native implementations.
PureUNC is not affiliated with or endorsed by UNC.
-----------------------------------------------------------------------------------------------------------------------
]]
local PureUNC = {
Version = "V1",
Functions = {},
Native = {}
}
local Game = game
local RobloxInstance = Instance
local RobloxTypeof = typeof
local function Service(Name)
local Success, Value = pcall(Game.GetService, Game, Name)
return Success and Value or nil
end
local RunService, Players, UserInputService, HttpService, UGCValidationService, ReplicatedFirst, StarterGui, StudioService, CoreGui, VirtualInput =
Service("RunService"),
Service("Players"),
Service("UserInputService"),
Service("HttpService"),
Service("UGCValidationService"),
Service("ReplicatedFirst"),
Service("StarterGui"),
Service("StudioService"),
Service("CoreGui"),
Service("VirtualInputManager")
local NativeGetFenv = type(getfenv) == "function" and getfenv or nil
local NativeGetGenv = type(getgenv) == "function" and getgenv or nil
local Environment = _G
local Global = _G
local IsStudio = RunService and RunService:IsStudio() or false
if NativeGetFenv then
pcall(function() Environment = NativeGetFenv(0) end)
end
if NativeGetGenv then
pcall(function() Global = NativeGetGenv() end)
end
if type(Environment) ~= "table" then Environment = _G end
if type(Global) ~= "table" then Global = Environment end
local CClosureCache = setmetatable({}, {__mode = "k"})
local ExecutorClosureCache = setmetatable({}, {__mode = "k"})
local ScriptEnvironmentCache = setmetatable({}, {__mode = "k"})
local CloneRefs = setmetatable({}, {__mode = "k"})
local InvalidRefs = setmetatable({}, {__mode = "k"})
local HiddenPropertyCache = setmetatable({}, {__mode = "k"})
local ScriptableCache = setmetatable({}, {__mode = "k"})
local DrawingCache = setmetatable({}, {__mode = "k"})
local InstanceCache = setmetatable({}, {__mode = "k"})
local Proxies = setmetatable({}, {__mode = "k"})
local SignalCache = setmetatable({}, {__mode = "k"})
local CallbackCache = setmetatable({}, {__mode = "k"})
local NamecallCache = setmetatable({}, {__mode = "k"})
local ReadonlyCache = setmetatable({}, {__mode = "k"})
local DebugMetadata = setmetatable({}, {__mode = "k"})
local SafeEnvironmentCache = setmetatable({}, {__mode = "k"})
local HiddenStackCache = setmetatable({}, {__mode = "k"})
local FlagCache = {}
local ClipboardCache = ""
local FPSCapCache = 60
local SimulationRadiusCache = 0
local WindowActive = true
local VirtualInput = VirtualInput
local ThreadIdentityCache = 8
local HiddenUI = nil
local Base64Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
local Base64DecodeMap = {}
local InstanceProxy = {}
local gameproxy = nil
if VirtualInput == nil then
pcall(function() VirtualInput = RobloxInstance.new("VirtualInputManager") end)
end
if UserInputService then
pcall(function()
UserInputService.WindowFocused:Connect(function() WindowActive = true end)
UserInputService.WindowFocusReleased:Connect(function() WindowActive = false end)
end)
end
pcall(function()
InstanceCache[Game] = true
for _, Object in Game:GetDescendants() do InstanceCache[Object] = true end
Game.DescendantAdded:Connect(function(Object) InstanceCache[Object] = true end)
Game.DescendantRemoving:Connect(function(Object) InstanceCache[Object] = true end)
end)
setmetatable(InstanceProxy, {__index = RobloxInstance})
InstanceProxy.new = function(Class, Parent)
local Object = RobloxInstance.new(Class)
InstanceCache[Object] = true
if Parent ~= nil then Object.Parent = Parent end
return Object
end
for Index = 1, #Base64Alphabet do
Base64DecodeMap[string.byte(Base64Alphabet, Index)] = Index - 1
end
local function NewProxy()
if type(newproxy) == "function" then
local x = newproxy(true)
return x, getmetatable(x)
end
local x = {}
local m = {}
setmetatable(x, m)
return x, m
end
local RawInstanceNew = InstanceProxy.new
local function WrapInstance(x, class)
if type(newproxy) ~= "function" then
return x
end
local pr, mt = NewProxy()
Proxies[pr] = x
local ev = nil
if class == "BindableEvent" then
local sp, smt = NewProxy()
local rec = {
owner = x,
connections = {}
}
SignalCache[sp] = rec
ev = sp
smt.__index = function(_, k)
if k == "Connect" or k == "connect" then
return function(_, fn)
assert(type(fn) == "function", "Connect expects a function", 2)
local cn = x.Event:Connect(fn)
rec.connections[#rec.connections + 1] = {
connection = cn,
func = fn,
enabled = true
}
return cn
end
elseif k == "Once" then
return function(_, fn)
assert(type(fn) == "function", "Once expects a function", 2)
local cn
cn = x.Event:Connect(function(...)
cn:Disconnect()
fn(...)
end)
rec.connections[#rec.connections + 1] = {
connection = cn,
func = fn,
enabled = true
}
return cn
end
elseif k == "Wait" then
return function()
return x.Event:Wait()
end
end
local ok, v = pcall(function()
return x.Event[k]
end)
if ok then
return v
end
return nil
end
smt.__tostring = function()
return tostring(x.Event)
end
end
mt.__index = function(t, k)
if k == "Event" and ev ~= nil then
return ev
end
local v = x[k]
if RobloxTypeof(v) == "function" then
return function(self, ...)
if self == t then
self = x
elseif Proxies[self] ~= nil then
self = Proxies[self]
end
return v(self, ...)
end
end
return v
end
mt.__newindex = function(_, k, v)
if class == "BindableFunction" and k == "OnInvoke" then
CallbackCache[pr] = v
CallbackCache[x] = v
end
x[k] = v
end
mt.__tostring = function()
return tostring(x)
end
return pr
end
InstanceProxy.new = function(c, par)
local x = RawInstanceNew(c)
local out = x
if c == "BindableEvent" or c == "BindableFunction" then
out = WrapInstance(x, c)
end
if par ~= nil then
if Proxies[out] ~= nil then
Proxies[out].Parent = par
else
out.Parent = par
end
end
return out
end
local function ExportValue(t, k, v, force)
if type(t) ~= "table" then
return 0
end
if not force then
local ok, old = pcall(function()
return t[k]
end)
if ok and old ~= nil then
return 0
end
end
local ok = pcall(function()
rawset(t, k, v)
end)
if not ok then
ok = pcall(function()
t[k] = v
end)
end
return ok and 1 or 0
end
local function AddEnvironment(a, seen, t)
if type(t) ~= "table" or seen[t] then
return
end
seen[t] = true
a[#a + 1] = t
end
local function Environments()
local a = {}
local seen = {}
AddEnvironment(a, seen, Global)
AddEnvironment(a, seen, Environment)
AddEnvironment(a, seen, _G)
if NativeGetGenv then
pcall(function()
AddEnvironment(a, seen, NativeGetGenv())
end)
end
if NativeGetFenv then
pcall(function()
AddEnvironment(a, seen, NativeGetFenv())
end)
pcall(function()
AddEnvironment(a, seen, NativeGetFenv(0))
end)
end
return a
end
local function EnsureTable(t, k)
if type(t) ~= "table" then
return nil
end
local ok, v = pcall(function()
return t[k]
end)
if ok and type(v) == "table" then
return v
end
if ok and v ~= nil then
return nil
end
local x = {}
local set = pcall(function()
rawset(t, k, x)
end)
if not set then
set = pcall(function()
t[k] = x
end)
end
return set and x or nil
end
PureUNC.getgenv = function()
return Global
end
PureUNC.base64encode = function(s)
assert(type(s) == "string", "invalid argument #1 to 'base64encode' (string expected)", 2)
if #s == 0 then
return ""
end
local o = {}
local n = 0
for i = 1, #s, 3 do
local a = string.byte(s, i) or 0
local b = string.byte(s, i + 1) or 0
local c = string.byte(s, i + 2) or 0
local v = bit32.lshift(a, 16) + bit32.lshift(b, 8) + c
local a1 = bit32.band(bit32.rshift(v, 18), 63) + 1
local a2 = bit32.band(bit32.rshift(v, 12), 63) + 1
local a3 = bit32.band(bit32.rshift(v, 6), 63) + 1
local a4 = bit32.band(v, 63) + 1
n += 1
o[n] = string.sub(Base64Alphabet, a1, a1)
n += 1
o[n] = string.sub(Base64Alphabet, a2, a2)
n += 1
o[n] = i + 1 <= #s and string.sub(Base64Alphabet, a3, a3) or "="
n += 1
o[n] = i + 2 <= #s and string.sub(Base64Alphabet, a4, a4) or "="
end
return table.concat(o)
end
PureUNC.base64decode = function(s)
assert(type(s) == "string", "invalid argument #1 to 'base64decode' (string expected)", 2)
if #s == 0 then
return ""
end
s = string.gsub(s, "%s", "")
assert(#s % 4 == 0, "invalid base64 length", 2)
local o = {}
local n = 0
for i = 1, #s, 4 do
local c1 = string.byte(s, i)
local c2 = string.byte(s, i + 1)
local c3 = string.byte(s, i + 2)
local c4 = string.byte(s, i + 3)
assert(c1 and c2 and Base64DecodeMap[c1] ~= nil and Base64DecodeMap[c2] ~= nil, "invalid base64 data", 2)
if c3 ~= 61 then
assert(Base64DecodeMap[c3] ~= nil, "invalid base64 data", 2)
end
if c4 ~= 61 then
assert(Base64DecodeMap[c4] ~= nil, "invalid base64 data", 2)
end
local a = Base64DecodeMap[c1]
local b = Base64DecodeMap[c2]
local c = c3 ~= 61 and Base64DecodeMap[c3] or 0
local d = c4 ~= 61 and Base64DecodeMap[c4] or 0
n += 1
o[n] = string.char(bit32.band(bit32.lshift(a, 2) + bit32.rshift(b, 4), 255))
if c3 ~= 61 then
n += 1
o[n] = string.char(bit32.band(bit32.lshift(b, 4) + bit32.rshift(c, 2), 255))
end
if c4 ~= 61 then
n += 1
o[n] = string.char(bit32.band(bit32.lshift(c, 6) + d, 255))
end
end
return table.concat(o)
end
PureUNC.base64_encode = PureUNC.base64encode
PureUNC.base64_decode = PureUNC.base64decode
PureUNC.base64 = {encode = PureUNC.base64encode, decode = PureUNC.base64decode}
PureUNC.crypt = {}
PureUNC.crypt.base64encode = PureUNC.base64encode
PureUNC.crypt.base64decode = PureUNC.base64decode
PureUNC.crypt.base64_encode = PureUNC.base64encode
PureUNC.crypt.base64_decode = PureUNC.base64decode
PureUNC.crypt.base64 = {encode = PureUNC.base64encode, decode = PureUNC.base64decode}
PureUNC.crypt.generatekey = function(n)
n = n or 32
assert(type(n) == "number", "invalid argument #1 to 'generatekey' (number expected)", 2)
n = math.floor(n)
assert(n >= 0, "invalid key length", 2)
local b = table.create(n)
for i = 1, n do
b[i] = string.char(math.random(0, 255))
end
return PureUNC.base64encode(table.concat(b))
end
PureUNC.crypt.generatebytes = PureUNC.crypt.generatekey
PureUNC.crypt.random = PureUNC.crypt.generatekey
PureUNC.crypt.encrypt = function(s, k)
s = tostring(s)
k = tostring(k)
assert(#k > 0, "key cannot be empty", 2)
local o = table.create(#s)
for i = 1, #s do
o[i] = string.char(bit32.bxor(string.byte(s, i), string.byte(k, (i - 1) % #k + 1)))
end
return table.concat(o), k
end
PureUNC.crypt.decrypt = PureUNC.crypt.encrypt
local function stream(s)
local t = {o = 0, s = s, l = #s, f = false, u = 0}
function t:read(n, shift)
n = n or 1
if shift == nil then
shift = true
end
local d = string.sub(self.s, self.o + 1, self.o + n)
self.u = n - #d
if shift then
self:seek(n)
end
return d
end
function t:seek(n)
self.o = math.clamp(self.o + (n or 1), 0, self.l)
self.f = self.o >= self.l
end
function t:append(s2)
self.s ..= s2
self.l = #self.s
self:seek(0)
end
function t:finish()
self:seek(self.l)
end
return t
end
local function pfind(s, q)
return string.find(s, q, 1, true)
end
PureUNC.lz4compress = function(s)
assert(type(s) == "string", "invalid argument #1 to 'lz4compress' (string expected)", 2)
local blocks = {}
local io = stream(s)
if io.l > 12 then
local first = io:read(4)
local proc = first
local lit = first
local match = ""
local pushv = ""
local pushlit = true
repeat
pushlit = true
pushv = ""
local nb = io:read()
if pfind(proc, nb) then
local n3 = io:read(3, false)
if #n3 < 3 then
pushv = nb .. n3
io:seek(3)
else
match = nb .. n3
local mp = pfind(proc, match)
if mp then
io:seek(3)
repeat
local nm = io:read(1, false)
local nr = match .. nm
local rp = pfind(proc, nr)
if rp then
match = nr
mp = rp
io:seek(1)
end
until not pfind(proc, nr) or io.f
local ml = #match
local pm = true
if io.l - io.o <= 5 then
pushv = match
pm = false
end
if pm then
pushlit = false
local pos = #proc - mp
proc ..= match
blocks[#blocks + 1] = {l = lit, ll = #lit, mo = pos + 1, ml = ml}
lit = ""
end
else
pushv = nb
end
end
else
pushv = nb
end
if pushlit then
lit ..= pushv
proc ..= nb
end
until io.f
blocks[#blocks + 1] = {l = lit, ll = #lit}
else
blocks[1] = {l = io.s, ll = #io.s}
end
local out = string.rep("\0", 4)
local function wr(c)
out ..= c
end
for i, b in blocks do
local ll = b.ll
local ml = (b.ml or 4) - 4
local tl = math.clamp(ll, 0, 15)
local tm = math.clamp(ml, 0, 15)
wr(string.pack("<I1", bit32.lshift(tl, 4) + tm))
if ll >= 15 then
ll -= 15
repeat
local x = math.clamp(ll, 0, 255)
wr(string.pack("<I1", x))
if x == 255 then
ll -= 255
end
until x < 255
end
wr(b.l)
if i ~= #blocks then
wr(string.pack("<I2", b.mo))
if ml >= 15 then
ml -= 15
repeat
local x = math.clamp(ml, 0, 255)
wr(string.pack("<I1", x))
if x == 255 then
ml -= 255
end
until x < 255
end
end
end
return string.pack("<I4", #out - 4) .. string.pack("<I4", io.l) .. out
end
PureUNC.lz4decompress = function(s)
assert(type(s) == "string", "invalid argument #1 to 'lz4decompress' (string expected)", 2)
local input = stream(s)
local cl = string.unpack("<I4", input:read(4))
local dl = string.unpack("<I4", input:read(4))
input:read(4)
if cl == 0 then
return input:read(dl)
end
local output = stream("")
repeat
local tok = string.byte(input:read())
local ll = bit32.rshift(tok, 4)
local ml = bit32.band(tok, 15) + 4
if ll >= 15 then
repeat
local x = string.byte(input:read())
ll += x
until x ~= 255
end
output:append(input:read(ll))
output:finish()
if output.l < dl then
local off = string.unpack("<I2", input:read(2))
if ml >= 19 then
repeat
local x = string.byte(input:read())
ml += x
until x ~= 255
end
output:seek(-off)
local pos = output.o
local mat = output:read(ml)
local unread = output.u
while unread > 0 do
output.o = pos
local ex = output:read(unread)
unread = output.u
mat ..= ex
end
output:append(mat)
output:finish()
end
until output.l >= dl
return output.s
end
PureUNC.identifyexecutor = function()
return "PureUNC", PureUNC.Version
end
PureUNC.getexecutorname = function()
local n = PureUNC.identifyexecutor()
return n
end
PureUNC.getexecutorversion = function()
local _, v = PureUNC.identifyexecutor()
return v
end
local function src(f)
if type(debug) ~= "table" or type(debug.info) ~= "function" then
return nil
end
local ok, s = pcall(debug.info, f, "s")
return ok and s or nil
end
PureUNC.islclosure = function(f)
assert(type(f) == "function", "invalid argument #1 to 'islclosure' (function expected)", 2)
if CClosureCache[f] then
return false
end
local s = src(f)
return s == nil or s ~= "[C]"
end
PureUNC.isluaclosure = PureUNC.islclosure
PureUNC.isclosure = PureUNC.islclosure
PureUNC.iscclosure = function(f)
assert(type(f) == "function", "invalid argument #1 to 'iscclosure' (function expected)", 2)
if CClosureCache[f] then
return true
end
local s = src(f)
return s ~= nil and s == "[C]"
end
PureUNC.newcclosure = function(f)
assert(type(f) == "function", "invalid argument #1 to 'newcclosure' (function expected)", 2)
local w = function(...)
return f(...)
end
CClosureCache[w] = true
ExecutorClosureCache[w] = true
return w
end
PureUNC.newclosure = PureUNC.newcclosure
PureUNC.isexecutorclosure = function(f)
assert(type(f) == "function", "invalid argument #1 to 'isexecutorclosure' (function expected)", 2)
return ExecutorClosureCache[f] == true
end
PureUNC.checkclosure = PureUNC.isexecutorclosure
PureUNC.isourclosure = PureUNC.isexecutorclosure
PureUNC.cloneref = function(obj)
local x, m = NewProxy()
m.__index = function(t, k)
local v = obj[k]
if typeof(v) == "function" then
return function(self, ...)
if self == t then
self = obj
end
return v(self, ...)
end
end
return v
end
m.__newindex = function(_, k, v)
obj[k] = v
end
m.__tostring = function()
return tostring(obj)
end
CloneRefs[x] = obj
return x
end
PureUNC.compareinstances = function(a, b)
if CloneRefs[a] then
a = CloneRefs[a]
end
if CloneRefs[b] then
b = CloneRefs[b]
end
if Proxies[a] then
a = Proxies[a]
end
if Proxies[b] then
b = Proxies[b]
end
return a == b
end
PureUNC.typeof = function(v)
if CloneRefs[v] ~= nil or Proxies[v] ~= nil then
return "Instance"
end
if SignalCache[v] ~= nil then
return "RBXScriptSignal"
end
return RobloxTypeof(v)
end
PureUNC.gethui = function()
if HiddenUI and HiddenUI.Parent then
return HiddenUI
end
local parent = nil
pcall(function()
parent = game:GetService("CoreGui")
end)
if not parent then
pcall(function()
local plr = game:GetService("Players").LocalPlayer
parent = plr and plr:FindFirstChildOfClass("PlayerGui")
end)
end
if not parent then
return nil
end
local ok, gui = pcall(function()
local x = Instance.new("ScreenGui")
x.Name = "PureUNC"
x.ResetOnSpawn = false
x.DisplayOrder = 999999
x.IgnoreGuiInset = true
x.Parent = parent
return x
end)
if ok then
HiddenUI = gui
end
return HiddenUI
end
local function font(n)
local ok, f = pcall(function()
return Enum.Font[n]
end)
return ok and f or Enum.Font.SourceSans
end
local fonts = {
[0] = font("SourceSans"),
[1] = font("SourceSansBold"),
[2] = font("Plex"),
[3] = font("Code")
}
local function getfont(f)
if type(f) == "number" then
return fonts[f] or Enum.Font.SourceSans
end
if type(f) == "string" then
return font(f)
end
return f or Enum.Font.SourceSans
end
local function alpha(t)
return math.clamp(t, 0, 1)
end
local function line(frame, st)
frame.BorderSizePixel = 0
frame.AnchorPoint = Vector2.new(0.5, 0.5)
frame.BackgroundColor3 = st.Color
frame.BackgroundTransparency = alpha(st.Transparency)
frame.ZIndex = st.ZIndex
frame.Visible = st.Visible
end
local function place(frame, a, b, thick)
local d = b - a
frame.Position = UDim2.fromOffset((a.X + b.X) / 2, (a.Y + b.Y) / 2)
frame.Size = UDim2.fromOffset(d.Magnitude, thick)
frame.Rotation = math.deg(math.atan(d.Y, d.X))
end
local function edge(frame, a, b, c)
local d = b - a
local nx, ny = -d.Y, d.X
local nl = math.sqrt(nx * nx + ny * ny)
if nl == 0 then
frame.Visible = false
return
end
local ux, uy = nx / nl, ny / nl
local mid = (a + b) / 2
local rel = c - mid
local dist = rel.X * ux + rel.Y * uy
frame.Position = UDim2.fromOffset(mid.X + ux * dist / 2, mid.Y + uy * dist / 2)
frame.Size = UDim2.fromOffset(d.Magnitude, math.abs(dist))
frame.Rotation = math.deg(math.atan(d.Y, d.X))
end
local function defaults(c)
local s = {Visible = false, Color = Color3.new(1, 1, 1), Transparency = 1, ZIndex = 0}
if c == "Line" then
s.From = Vector2.zero
s.To = Vector2.zero
s.Thickness = 1
elseif c == "Square" then
s.Position = Vector2.zero
s.Size = Vector2.zero
s.Thickness = 1
s.Filled = false
elseif c == "Circle" then
s.Position = Vector2.zero
s.Radius = 0
s.Thickness = 1
s.Filled = false
s.NumSides = 30
elseif c == "Text" then
s.Text = ""
s.Size = 13
s.Center = false
s.Outline = false
s.OutlineColor = Color3.new(0, 0, 0)
s.Position = Vector2.zero
s.Font = 0
elseif c == "Image" then
s.Url = ""
s.Data = ""
s.Position = Vector2.zero
s.Size = Vector2.zero
s.Rounding = 0
elseif c == "Triangle" then
s.PointA = Vector2.zero
s.PointB = Vector2.zero
s.PointC = Vector2.zero
s.Thickness = 1
s.Filled = false
elseif c == "Quad" then
s.PointA = Vector2.zero
s.PointB = Vector2.zero
s.PointC = Vector2.zero
s.PointD = Vector2.zero
s.Thickness = 1
s.Filled = false
end
return s
end
local builders = {}
builders.Line = function(e)
local f = Instance.new("Frame")
f.Visible = false
f.Parent = PureUNC.gethui()
e.i[#e.i + 1] = f
e.a = function()
line(f, e.s)
place(f, e.s.From, e.s.To, e.s.Thickness)
end
end
builders.Square = function(e)
local f = Instance.new("Frame")
local u = Instance.new("UIStroke")
f.Visible = false
u.Enabled = false
u.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
u.Parent = f
f.Parent = PureUNC.gethui()
e.i[#e.i + 1] = f
e.a = function()
local s = e.s
f.BackgroundColor3 = s.Color
f.Position = UDim2.fromOffset(s.Position.X, s.Position.Y)
f.Size = UDim2.fromOffset(s.Size.X, s.Size.Y)
f.ZIndex = s.ZIndex
f.Visible = s.Visible
if s.Filled then
f.BackgroundTransparency = alpha(s.Transparency)
u.Enabled = false
else
f.BackgroundTransparency = 1
u.Enabled = true
u.Color = s.Color
u.Thickness = s.Thickness
u.Transparency = alpha(s.Transparency)
end
end
end
builders.Circle = function(e)
local f = Instance.new("Frame")
local c = Instance.new("UICorner")
local u = Instance.new("UIStroke")
f.Visible = false
f.AnchorPoint = Vector2.new(0.5, 0.5)
c.CornerRadius = UDim.new(1, 0)
c.Parent = f
u.Enabled = false
u.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
u.Parent = f
f.Parent = PureUNC.gethui()
e.i[#e.i + 1] = f
e.a = function()
local s = e.s
f.BackgroundColor3 = s.Color
f.Position = UDim2.fromOffset(s.Position.X, s.Position.Y)
f.Size = UDim2.fromOffset(s.Radius * 2, s.Radius * 2)
f.ZIndex = s.ZIndex
f.Visible = s.Visible
if s.Filled then
f.BackgroundTransparency = alpha(s.Transparency)
u.Enabled = false
else
f.BackgroundTransparency = 1
u.Enabled = true
u.Color = s.Color
u.Thickness = s.Thickness
u.Transparency = alpha(s.Transparency)
end
end
end
builders.Text = function(e)
local l = Instance.new("TextLabel")
local u = Instance.new("UIStroke")
l.Visible = false
l.BackgroundTransparency = 1
l.BorderSizePixel = 0
l.AutomaticSize = Enum.AutomaticSize.XY
l.Size = UDim2.new(0, 0, 0, 0)
u.Enabled = false
u.Thickness = 2
u.Parent = l
l.Parent = PureUNC.gethui()
e.i[#e.i + 1] = l
e.a = function()
local s = e.s
l.Text = s.Text
l.TextColor3 = s.Color
l.TextTransparency = alpha(s.Transparency)
l.TextSize = s.Size
l.Font = getfont(s.Font)
l.AnchorPoint = Vector2.new(s.Center and 0.5 or 0, 0)
l.Position = UDim2.fromOffset(s.Position.X, s.Position.Y)
l.ZIndex = s.ZIndex
l.Visible = s.Visible
u.Enabled = s.Outline
u.Color = s.OutlineColor
end
end
builders.Image = function(e)
local i = Instance.new("ImageLabel")
local c = Instance.new("UICorner")
i.Visible = false
i.BackgroundTransparency = 1
c.Parent = i
i.Parent = PureUNC.gethui()
e.i[#e.i + 1] = i
e.a = function()
local s = e.s
i.Image = s.Url ~= "" and s.Url or s.Data
i.ImageColor3 = s.Color
i.ImageTransparency = alpha(s.Transparency)
i.Position = UDim2.fromOffset(s.Position.X, s.Position.Y)
i.Size = UDim2.fromOffset(s.Size.X, s.Size.Y)
i.ZIndex = s.ZIndex
i.Visible = s.Visible
c.CornerRadius = UDim.new(0, s.Rounding)
end
end
local function poly(e, pts)
for _ = 1, #pts * 2 do
local f = Instance.new("Frame")
f.Visible = false
f.Parent = PureUNC.gethui()
e.i[#e.i + 1] = f
end
e.a = function()
local s = e.s
local n = #pts
for _, x in e.i do
x.Visible = false
end
if s.Filled then
for i = 1, n do
local a = s[pts[i]]
local b = s[pts[i % n + 1]]
local c = s[pts[(i + 1) % n + 1]]
local f = e.i[n + i]
line(f, s)
edge(f, a, b, c)
end
else
for i = 1, n do
local a = s[pts[i]]
local b = s[pts[i % n + 1]]
local f = e.i[i]
line(f, s)
place(f, a, b, s.Thickness)
end
end
end
end
builders.Triangle = function(e)
poly(e, {"PointA", "PointB", "PointC"})
end
builders.Quad = function(e)
poly(e, {"PointA", "PointB", "PointC", "PointD"})
end
PureUNC.Drawing = {}
PureUNC.Drawing.Fonts = {UI = 0, System = 1, Plex = 2, Monospace = 3}
PureUNC.Drawing.new = function(c, props)
assert(type(c) == "string", "invalid argument #1 to 'Drawing.new' (string expected)", 2)
local b = builders[c]
assert(b, "invalid drawing type", 2)
assert(PureUNC.gethui() ~= nil, "Drawing unavailable: no GUI parent", 2)
local e = {c = c, s = defaults(c), i = {}, x = true}
b(e)
e.a()
local x, m = NewProxy()
m.__index = function(_, k)
if k == "Remove" or k == "Destroy" then
return e.r
end
if k == "__OBJECT_EXISTS" then
return e.x
end
if e.s[k] ~= nil then
return e.s[k]
end
if k == "TextBounds" and c == "Text" then
return e.i[1].TextBounds
end
error(tostring(k) .. " is not a valid member of Drawing (" .. c .. ")", 2)
end
m.__newindex = function(_, k, v)
assert(e.s[k] ~= nil, tostring(k) .. " is not a valid member of Drawing (" .. c .. ")", 2)
e.s[k] = v
e.a()
end
m.__tostring = function()
return "Drawing (" .. c .. ")"
end
e.r = function()
if not e.x then
return
end
e.x = false
for _, i in e.i do
pcall(function()
i:Destroy()
end)
end
e.i = {}
DrawingCache[x] = nil
end
DrawingCache[x] = e
if type(props) == "table" then
for k, v in props do
x[k] = v
end
end
return x
end
PureUNC.isrenderobj = function(x)
return DrawingCache[x] ~= nil
end
PureUNC.cleardrawcache = function()
for x, e in DrawingCache do
if e then
e.r()
end
end
end
PureUNC.isrenderavailable = function()
return PureUNC.gethui() ~= nil
end
PureUNC.getrenderproperty = function(x, k)
assert(DrawingCache[x], "invalid argument #1 to 'getrenderproperty' (Drawing expected)", 2)
return x[k]
end
PureUNC.setrenderproperty = function(x, k, v)
assert(DrawingCache[x], "invalid argument #1 to 'setrenderproperty' (Drawing expected)", 2)
x[k] = v
end
local function enginepath(i)
local ok, n = pcall(function()
return i:GetFullName()
end)
if not ok then
return false
end
return n:find("CoreGui") ~= nil or n:find("CorePackages") ~= nil or n:find("CoreScripts") ~= nil
end
PureUNC.getscripts = function()
local out = {}
local seen = {}
for _, i in PureUNC.getinstances() do
local ok, yes = pcall(function()
return i:IsA("LocalScript") or i:IsA("ModuleScript")
end)
if ok and yes and not enginepath(i) and not seen[i] then
seen[i] = true
out[#out + 1] = i
end
end
return out
end
PureUNC.getrunningscripts = function()
local out = {}
for _, i in PureUNC.getscripts() do
local ok, yes = pcall(function()
return i:FindFirstAncestorOfClass("Actor") == nil
end)
if ok and yes then
out[#out + 1] = i
end
end
return out
end
PureUNC.getloadedmodules = function()
local out = {}
for _, i in PureUNC.getscripts() do
local ok, yes = pcall(function()
return i:IsA("ModuleScript")
end)
if ok and yes then
out[#out + 1] = i
end
end
return out
end
PureUNC.getnilinstances = function()
local out = {}
local seen = {}
for i in InstanceCache do
if i ~= game and not seen[i] and typeof(i) == "Instance" then
local ok, par = pcall(function()
return i.Parent
end)
if ok and par == nil then
seen[i] = true
out[#out + 1] = i
end
end
end
return out
end
PureUNC.getinstances = function()
local out = {}
local seen = {}
local function add(i)
if typeof(i) == "Instance" and not seen[i] then
seen[i] = true
out[#out + 1] = i
end
end
add(game)
for _, i in game:GetDescendants() do
add(i)
end
for i in InstanceCache do
add(i)
end
return out
end
PureUNC.isnetworkowner = function(part)
if typeof(part) ~= "Instance" or not part:IsA("BasePart") then
return false
end
if part.Anchored then
return false
end
local ok, grounded = pcall(function()
return part:IsGrounded()
end)
if ok and grounded then
return false
end
local aok, age = pcall(function()
return part.ReceiveAge
end)
return aok and age == 0
end
local kh = {size_xml = true, NetworkOwnerV3 = true}
local kd = {size_xml = 5, NetworkOwnerV3 = -1}
PureUNC.isscriptable = function(obj, prop)
assert(type(obj) == "userdata" or type(obj) == "table", "invalid argument #1 to 'isscriptable'", 2)
local o = ScriptableCache[obj]
if o and o[prop] ~= nil then
return o[prop]
end
if kh[prop] == true then
return false
end
local ok = pcall(function()
local _ = obj[prop]
end)
if ok then
return true
end
if UGCValidationService and PureUNC.typeof(obj) == "Instance" then
local uok = pcall(function()
UGCValidationService:GetPropertyValue(Proxies[obj] or CloneRefs[obj] or obj, prop)
end)
if uok then
return false
end
end
return false
end
PureUNC.setscriptable = function(obj, prop, yes)
assert(type(obj) == "userdata" or type(obj) == "table", "invalid argument #1 to 'setscriptable'", 2)
local o = ScriptableCache[obj]
if not o then
o = {}
ScriptableCache[obj] = o
end
local old = PureUNC.isscriptable(obj, prop)
o[prop] = yes
return old
end
PureUNC.gethiddenproperty = function(obj, prop)
assert(PureUNC.typeof(obj) == "Instance", "invalid argument #1 to 'gethiddenproperty' (Instance expected)", 2)
local Raw = Proxies[obj] or CloneRefs[obj] or obj
local Cache = HiddenPropertyCache[obj] or HiddenPropertyCache[Raw]
if Cache and Cache[prop] ~= nil then
return Cache[prop], true
end
if UGCValidationService then
local Success, Value = pcall(function()
return UGCValidationService:GetPropertyValue(Raw, prop)
end)
if Success then
return Value, true
end
end
local Success, Value = pcall(function()
return Raw[prop]
end)
if Success then
return Value, kh[prop] == true
end
if kd[prop] ~= nil then
return kd[prop], true
end
return nil, PureUNC.isscriptable(Raw, prop) == false
end
PureUNC.sethiddenproperty = function(obj, prop, Value)
assert(PureUNC.typeof(obj) == "Instance", "invalid argument #1 to 'sethiddenproperty' (Instance expected)", 2)
local Raw = Proxies[obj] or CloneRefs[obj] or obj
local Cache = HiddenPropertyCache[obj]
if not Cache then
Cache = {}
HiddenPropertyCache[obj] = Cache
end
local Hidden = Cache[prop] ~= nil or kh[prop] == true
if not Hidden then
Hidden = PureUNC.isscriptable(Raw, prop) == false
end
local Success = pcall(function()
Raw[prop] = Value
end)
if not Success or kh[prop] == true then
Cache[prop] = Value
end
return Hidden
end
PureUNC.getthreadidentity = function()
return ThreadIdentityCache
end
PureUNC.setthreadidentity = function(n)
assert(type(n) == "number", "invalid argument #1 to 'setthreadidentity' (number expected)", 2)
ThreadIdentityCache = math.floor(n)
end
PureUNC.getidentity = PureUNC.getthreadidentity
PureUNC.setidentity = PureUNC.setthreadidentity
PureUNC.getthreadcontext = PureUNC.getthreadidentity
PureUNC.setthreadcontext = PureUNC.setthreadidentity
PureUNC.printidentity = function()
local n = PureUNC.getthreadidentity()
print(tostring(n))
return n
end
local renv = {_G = {}, shared = {}}
setmetatable(renv, {__index = Environment, __newindex = Environment})
PureUNC.getrenv = function()
return renv
end
PureUNC.getsenv = function(s)
assert(typeof(s) == "Instance" and s:IsA("LuaSourceContainer"), "invalid argument #1 to 'getsenv' (LuaSourceContainer expected)", 2)
local e = ScriptEnvironmentCache[s]
if not e then
e = {script = s}
setmetatable(e, {__index = Environment, __newindex = Environment})
ScriptEnvironmentCache[s] = e
end
return e
end
PureUNC.getcallingscript = function()
return nil
end
PureUNC.getscriptfromthread = function()
return nil
end
PureUNC.cache = {}
PureUNC.cache.invalidate = function(obj)
if CloneRefs[obj] ~= nil then
CloneRefs[obj] = nil
end
local dead = {}
for x, o in CloneRefs do
if o == obj then
dead[#dead + 1] = x
end
end
for _, x in dead do
CloneRefs[x] = nil
end
InvalidRefs[obj] = true
end
PureUNC.cache.iscached = function(obj)
if CloneRefs[obj] ~= nil then
return true
end
if InvalidRefs[obj] then
return false
end
return typeof(obj) == "Instance" or obj == game
end
PureUNC.cache.replace = function(obj, repl)
if CloneRefs[obj] ~= nil then
CloneRefs[obj] = repl
end
end
PureUNC.getrawmetatable = function(obj)
local Raw = obj
if CloneRefs[Raw] ~= nil then
Raw = CloneRefs[Raw]
elseif Proxies[Raw] ~= nil then
Raw = Proxies[Raw]
end
local Success, Metatable = pcall(getmetatable, Raw)
if Success and type(Metatable) == "table" then
return Metatable
end
return {
__index = function(_, Key)
return Raw[Key]
end,
__newindex = function(_, Key, Value)
Raw[Key] = Value
end
}
end
PureUNC.setrawmetatable = function(obj, m)
local ok, e = pcall(setmetatable, obj, m)
if not ok then error(e, 2) end
return obj
end
PureUNC.debuggetinfo = function(f, w)
assert(type(f) == "function", "bad argument #1 to 'debug.getinfo' (function expected)", 2)
local di = type(debug) == "table" and debug.info or nil
local function opt(o)
if type(di) ~= "function" then
return nil
end
local x = table.pack(pcall(di, f, o))
if x[1] then
return table.unpack(x, 2, x.n)
end
return nil
end
local s = opt("s") or "[C]"
local np, va = opt("a")
return {
source = s,
short_src = s,
func = f,
what = s == "[C]" and "C" or "Lua",
currentline = opt("l") or -1,
name = opt("n") or "",
numparams = np or 0,
is_vararg = va and 1 or 0,
nups = 0
}
end
local function fnret(f)
if type(f) ~= "function" then
return nil
end
if type(debug) == "table" and type(debug.info) == "function" then
local ok, np = pcall(debug.info, f, "a")
if ok and type(np) == "number" and np > 0 then
return nil
end
end
local r = table.pack(pcall(f))
if not r[1] then
return nil
end
local o = {}
for i = 2, r.n do
o[#o + 1] = r[i]
end
return o
end
PureUNC.debuggetconstant = function(f, i)
assert(type(f) == "function", "bad argument #1 to 'debug.getconstant' (function expected)", 2)
assert(type(i) == "number", "bad argument #2 to 'debug.getconstant' (number expected)", 2)
local r = fnret(f)
if not r then return nil end
local c = {}
for _, v in r do
local t = type(v)
if t == "string" or t == "number" or t == "boolean" or t == "nil" then
c[#c + 1] = v
end
end
return c[i]
end
PureUNC.debuggetconstants = function(f)
assert(type(f) == "function", "bad argument #1 to 'debug.getconstants' (function expected)", 2)
local r = fnret(f) or {}
local c = {}
for _, v in r do
local t = type(v)
if t == "string" or t == "number" or t == "boolean" then
c[#c + 1] = v
end
end
return c
end
PureUNC.debuggetproto = function(f, i, active)
assert(type(f) == "function", "bad argument #1 to 'debug.getproto' (function expected)", 2)
assert(type(i) == "number", "bad argument #2 to 'debug.getproto' (number expected)", 2)
local r = fnret(f) or {}
local a = {}
for _, v in r do
if type(v) == "function" then a[#a + 1] = v end
end
local v = a[i]
if active and v ~= nil then return {v} end
return v
end
PureUNC.debuggetprotos = function(f)
assert(type(f) == "function", "bad argument #1 to 'debug.getprotos' (function expected)", 2)
local r = fnret(f) or {}
local a = {}
for _, v in r do
if type(v) == "function" then a[#a + 1] = v end
end
return a
end
PureUNC.debuggetstack = function(level, index)
level = level or 1
assert(type(level) == "number", "bad argument #1 to 'debug.getstack' (number expected)", 2)
local t = {}
if type(debug) == "table" and type(debug.info) == "function" then
local ok, f = pcall(debug.info, level + 1, "f")
if ok and f ~= nil then t[1] = f end
end
if index ~= nil then return t[index] or t[1] or false end
return t
end
PureUNC.debuggetupvalue = function(f, i)
assert(type(f) == "function", "bad argument #1 to 'debug.getupvalue' (function expected)", 2)
assert(type(i) == "number", "bad argument #2 to 'debug.getupvalue' (number expected)", 2)
local r = fnret(f) or {}
return r[i], ""
end
PureUNC.debuggetupvalues = function(f)
assert(type(f) == "function", "bad argument #1 to 'debug.getupvalues' (function expected)", 2)
return fnret(f) or {}
end
PureUNC.debuggetcallstack = function()
local out = {}
if type(debug) == "table" and type(debug.info) == "function" then
for i = 2, 64 do
local ok, f = pcall(debug.info, i, "f")
if not ok or f == nil then break end
out[#out + 1] = f
end
end
return out
end
PureUNC.debuggetregistry = function()
return PureUNC.getreg and PureUNC.getreg() or {[1] = coroutine.running(), _G = Global}
end
PureUNC.debuggetsafeenv = function(f)
if type(f) == "function" and SafeEnvironmentCache[f] ~= nil then return SafeEnvironmentCache[f] end
return true
end
PureUNC.debugisvalidlevel = function(level)
if type(level) ~= "number" then return false end
if type(debug) ~= "table" or type(debug.info) ~= "function" then return level >= 0 end
local ok, f = pcall(debug.info, level + 1, "f")
return ok and f ~= nil
end
PureUNC.debugsetname = function(f, name)
if type(f) == "function" then
DebugMetadata[f] = DebugMetadata[f] or {}
DebugMetadata[f].name = tostring(name or "")
end
return f
end
PureUNC.debugsetinfo = function(f, a, b)
if type(f) ~= "function" then return end
DebugMetadata[f] = DebugMetadata[f] or {}
if type(a) == "table" then
for k, v in a do DebugMetadata[f][k] = v end
elseif type(a) == "string" then
DebugMetadata[f][a] = b
end
end
PureUNC.debugsetsafeenv = function(a, b)
if type(a) == "function" then
SafeEnvironmentCache[a] = b ~= false
end
return true
end
local rc = {gui = nil, title = nil, out = nil, input = nil, lines = {}, pending = nil, name = "PureUNC Console", building = false}
local function rcparent()
local ok, pl = pcall(function()
return Game:GetService("Players").LocalPlayer
end)
if ok and pl then
local pg = pl:FindFirstChildOfClass("PlayerGui")
if pg then return pg end
end
local ok2, cg = pcall(function() return Game:GetService("CoreGui") end)
if ok2 then return cg end
return nil
end
local function rcdraw()
if rc.out then
pcall(function()
rc.out.Text = table.concat(rc.lines, "\n")
rc.out.CursorPosition = #rc.out.Text + 1
end)
end
end
local function rcadd(v)
rc.lines[#rc.lines + 1] = tostring(v)
rcdraw()
end
local function rcbuild()
if rc.gui and rc.gui.Parent then return true end
if rc.building then
local dl = os.clock() + 2
repeat task.wait() until not rc.building or os.clock() >= dl
return rc.gui ~= nil
end
rc.building = true
local ok = pcall(function()
local par = rcparent()
if not par then return end
local sg = RobloxInstance.new("ScreenGui")
sg.Name = "PureUNCRConsole"
sg.ResetOnSpawn = false
sg.IgnoreGuiInset = true
local fr = RobloxInstance.new("Frame")
fr.Size = UDim2.fromOffset(720, 420)
fr.Position = UDim2.new(0.5, -360, 0.5, -210)
fr.BackgroundColor3 = Color3.fromRGB(18, 18, 18)
fr.BorderSizePixel = 0
fr.Parent = sg
local ti = RobloxInstance.new("TextLabel")
ti.Size = UDim2.new(1, 0, 0, 30)
ti.BackgroundColor3 = Color3.fromRGB(28, 28, 28)
ti.BorderSizePixel = 0
ti.TextColor3 = Color3.new(1, 1, 1)
ti.Font = Enum.Font.Code
ti.TextSize = 16
ti.TextXAlignment = Enum.TextXAlignment.Left
ti.Text = " " .. rc.name
ti.Parent = fr
local out = RobloxInstance.new("TextBox")
out.Size = UDim2.new(1, -12, 1, -78)
out.Position = UDim2.fromOffset(6, 36)
out.BackgroundTransparency = 1
out.ClearTextOnFocus = false
out.MultiLine = true
out.TextEditable = false
out.TextWrapped = false
out.TextXAlignment = Enum.TextXAlignment.Left
out.TextYAlignment = Enum.TextYAlignment.Top
out.TextColor3 = Color3.fromRGB(230, 230, 230)
out.Font = Enum.Font.Code
out.TextSize = 14
out.Text = table.concat(rc.lines, "\n")
out.Parent = fr
local inp = RobloxInstance.new("TextBox")
inp.Size = UDim2.new(1, -12, 0, 30)
inp.Position = UDim2.new(0, 6, 1, -36)
inp.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
inp.BorderSizePixel = 0
inp.TextColor3 = Color3.new(1, 1, 1)
inp.PlaceholderText = "console input"
inp.ClearTextOnFocus = false
inp.Font = Enum.Font.Code
inp.TextSize = 14
inp.Visible = false
inp.Parent = fr
inp.FocusLost:Connect(function(enter)
if enter and rc.pending then
local f = rc.pending
rc.pending = nil
local v = inp.Text
inp.Text = ""
inp.Visible = false
rcadd("> " .. v)
f(v)
end
end)
sg.Parent = par
rc.gui = sg
rc.title = ti
rc.out = out
rc.input = inp
end)
rc.building = false
rcdraw()
return ok and rc.gui ~= nil
end
PureUNC.rconsolecreate = function()
task.spawn(rcbuild)
return true
end
PureUNC.rconsoleclear = function()
table.clear(rc.lines)
rcdraw()
return true
end
PureUNC.rconsoledestroy = function()
local g = rc.gui
rc.gui = nil
rc.title = nil
rc.out = nil
rc.input = nil
rc.pending = nil
if g then task.spawn(function() pcall(function() g:Destroy() end) end) end
return true
end
PureUNC.rconsoleprint = function(v)
rcadd(v)
task.spawn(rcbuild)
print(tostring(v))
return true
end
PureUNC.rconsoleinfo = function(v)
rcadd("[INFO] " .. tostring(v))
task.spawn(rcbuild)
print("[INFO] " .. tostring(v))
return true
end
PureUNC.rconsolewarn = function(v)
rcadd("[WARN] " .. tostring(v))
task.spawn(rcbuild)
warn(tostring(v))
return true
end
PureUNC.rconsoleerror = function(v)
rcadd("[ERROR] " .. tostring(v))
task.spawn(rcbuild)
warn("[ERROR] " .. tostring(v))
return true
end
PureUNC.rconsoleinput = function()
if not rcbuild() or not rc.input then return "" end
local done = false
local val = ""
rc.pending = function(v) val = v done = true end
rc.input.Visible = true
pcall(function() rc.input:CaptureFocus() end)
local dl = os.clock() + 12
repeat task.wait(0.03) until done or os.clock() >= dl
if not done then
val = rc.input.Text or ""
rc.pending = nil
rc.input.Visible = false
end
return val
end
PureUNC.rconsolesettitle = function(v)
rc.name = tostring(v)
if rc.title then pcall(function() rc.title.Text = " " .. rc.name end) end
task.spawn(rcbuild)
return true
end
PureUNC.rconsolename = PureUNC.rconsolesettitle
PureUNC.consolecreate = PureUNC.rconsolecreate
PureUNC.consoleclear = PureUNC.rconsoleclear
PureUNC.consoledestroy = PureUNC.rconsoledestroy
PureUNC.consoleprint = PureUNC.rconsoleprint
PureUNC.consoleinfo = PureUNC.rconsoleinfo
PureUNC.consolewarn = PureUNC.rconsolewarn
PureUNC.consoleerror = PureUNC.rconsoleerror
PureUNC.consoleinput = PureUNC.rconsoleinput
PureUNC.consolesettitle = PureUNC.rconsolesettitle
PureUNC.clonefunction = function(f)
assert(type(f) == "function", "invalid argument #1 to 'clonefunction' (function expected)", 2)
local o = f
local c = function(...)
return o(...)
end
ExecutorClosureCache[c] = true
return c
end
PureUNC.checkcaller = function()
return true
end
PureUNC.getcallbackvalue = function(obj, k)
assert(PureUNC.typeof(obj) == "Instance", "invalid argument #1 to 'getcallbackvalue' (Instance expected)", 2)
assert(type(k) == "string", "invalid argument #2 to 'getcallbackvalue' (string expected)", 2)
if k == "OnInvoke" then
local v = CallbackCache[obj]
if v ~= nil then
return v
end
local raw = Proxies[obj] or obj
v = CallbackCache[raw]
if v ~= nil then
return v
end
end
local raw = Proxies[obj] or CloneRefs[obj] or obj
local ok, v = pcall(function()
return raw[k]
end)
if ok then
return v
end
return nil
end
PureUNC.fireproximityprompt = function(x)
assert(typeof(x) == "Instance" and x:IsA("ProximityPrompt"), "invalid argument #1 to 'fireproximityprompt' (ProximityPrompt expected)", 2)
local h = x.HoldDuration
local d = x.MaxActivationDistance
local r = x.RequiresLineOfSight
local e = x.Enabled
pcall(function()
x.HoldDuration = 0
x.MaxActivationDistance = math.huge
x.RequiresLineOfSight = false
x.Enabled = true
end)
local ok, er = pcall(function()
x:InputHoldBegin()
task.wait()
x:InputHoldEnd()
end)
pcall(function()
x.HoldDuration = h
x.MaxActivationDistance = d
x.RequiresLineOfSight = r
x.Enabled = e
end)
if not ok then
error(er, 2)
end
end
local function keycode(v)
if typeof(v) == "EnumItem" then
return v
end
if type(v) == "string" then
local n = #v == 1 and string.upper(v) or v
local ok, k = pcall(function()
return Enum.KeyCode[n]
end)
if ok and k then
return k
end
end
if type(v) == "number" then
if v >= 65 and v <= 90 then
return Enum.KeyCode[string.char(v)]
end
if v >= 48 and v <= 57 then
local ns = {"Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"}
return Enum.KeyCode[ns[v - 47]]
end
local m = {
[8] = "Backspace", [9] = "Tab", [13] = "Return", [16] = "LeftShift", [17] = "LeftControl", [18] = "LeftAlt",
[27] = "Escape", [32] = "Space", [37] = "Left", [38] = "Up", [39] = "Right", [40] = "Down", [45] = "Insert", [46] = "Delete"
}
if v >= 112 and v <= 123 then
m[v] = "F" .. tostring(v - 111)
end
if m[v] then
return Enum.KeyCode[m[v]]
end
end
error("invalid key", 3)
end
local function vk(v)
if type(v) == "number" then
return v
end
local k = keycode(v)
local n = k.Name
if #n == 1 then
return string.byte(n)
end
local m = {Backspace = 8, Tab = 9, Return = 13, LeftShift = 16, RightShift = 16, LeftControl = 17, RightControl = 17, LeftAlt = 18, RightAlt = 18, Escape = 27, Space = 32, Left = 37, Up = 38, Right = 39, Down = 40, Insert = 45, Delete = 46}
if m[n] then
return m[n]
end
local f = n:match("^F(%d+)$")
if f then
return 111 + tonumber(f)
end
return nil
end
local nkp = nil
local nkr = nil
for _, g in Environments() do
if nkp == nil then
local ok, f = pcall(function()
return g.keypress
end)
if ok and type(f) == "function" then
nkp = f
end
end
if nkr == nil then
local ok, f = pcall(function()
return g.keyrelease
end)
if ok and type(f) == "function" then
nkr = f
end
end
end
local function SendKey(v, down)
local k = keycode(v)
if VirtualInput then
local ok = pcall(function()
VirtualInput:SendKeyEvent(down, k, false, game)
end)
if ok then
return true
end
end
local f = down and nkp or nkr
local n = vk(v)
if f and n then
local ok = pcall(f, n)
if ok then
return true
end
end
return false
end
PureUNC.keypress = function(v)
assert(SendKey(v, true), "input injection unavailable", 2)
end
PureUNC.keyrelease = function(v)
assert(SendKey(v, false), "input injection unavailable", 2)
end
PureUNC.keyclick = function(v)
assert(SendKey(v, true), "input injection unavailable", 2)
assert(SendKey(v, false), "input injection unavailable", 2)
end
PureUNC.keytap = PureUNC.keyclick
PureUNC.getmousepos = function()
assert(UserInputService, "mouse input unavailable", 2)
local v = UserInputService:GetMouseLocation()
return v.X, v.Y
end
PureUNC.getmouselocation = PureUNC.getmousepos
local function MoveMouse(x, y)
if not VirtualInput then
return false
end
return pcall(function()
VirtualInput:SendMouseMoveEvent(x, y, game)
end)
end
PureUNC.mousemoveabs = function(x, y)
assert(type(x) == "number" and type(y) == "number", "mousemoveabs expects x and y numbers", 2)
assert(MoveMouse(x, y), "input injection unavailable", 2)
end
PureUNC.movemouse = PureUNC.mousemoveabs
PureUNC.mousemoverel = function(x, y)
assert(type(x) == "number" and type(y) == "number", "mousemoverel expects x and y numbers", 2)
local a, b = PureUNC.getmousepos()
assert(MoveMouse(a + x, b + y), "input injection unavailable", 2)
end
PureUNC.mouserel = PureUNC.mousemoverel
PureUNC.mousescroll = function(v)
assert(type(v) == "number", "mousescroll expects a number", 2)
if not VirtualInput then
return false
end
local x, y = PureUNC.getmousepos()
local ok = pcall(function()
VirtualInput:SendMouseWheelEvent(x, y, v > 0, game)
end)
return ok
end
local function MouseButton(n, down)
if not VirtualInput then
return false
end
local x, y = PureUNC.getmousepos()
local ok = pcall(function()
VirtualInput:SendMouseButtonEvent(x, y, n, down, game, 0)
end)
return ok
end
PureUNC.mouse1press = function()
MouseButton(0, true)
end
PureUNC.mouse1release = function()
MouseButton(0, false)
end
PureUNC.mouse1click = function()
PureUNC.mouse1press()
PureUNC.mouse1release()
end
PureUNC.mouse2press = function()
MouseButton(1, true)
end
PureUNC.mouse2release = function()
MouseButton(1, false)
end
PureUNC.mouse2click = function()
PureUNC.mouse2press()
PureUNC.mouse2release()
end
PureUNC.middlepress = function()
MouseButton(2, true)
end
PureUNC.middlerelease = function()
MouseButton(2, false)
end
PureUNC.middleclick = function()
PureUNC.middlepress()
PureUNC.middlerelease()
end
PureUNC.iswindowactive = function()
return WindowActive
end
PureUNC.isrbxactive = PureUNC.iswindowactive
PureUNC.isgameactive = PureUNC.iswindowactive
PureUNC.getnamecallmethod = function()
return NamecallCache[coroutine.running()]
end
PureUNC.setnamecallmethod = function(v)
assert(v == nil or type(v) == "string", "invalid argument #1 to 'setnamecallmethod' (string expected)", 2)
NamecallCache[coroutine.running()] = v
end
PureUNC.isreadonly = function(t)
assert(type(t) == "table", "invalid argument #1 to 'isreadonly' (table expected)", 2)
if ReadonlyCache[t] ~= nil then
return ReadonlyCache[t]
end
if type(table.isfrozen) == "function" then
local ok, v = pcall(table.isfrozen, t)
if ok then
return v
end
end
return false
end
PureUNC.setreadonly = function(t, v)
assert(type(t) == "table", "invalid argument #1 to 'setreadonly' (table expected)", 2)
ReadonlyCache[t] = v ~= false
return t
end
PureUNC.makereadonly = function(t)
return PureUNC.setreadonly(t, true)
end
PureUNC.makewritable = function(t)
return PureUNC.setreadonly(t, false)
end
local function StringHash(s)
local h = 5381
for i = 1, #s do
h = bit32.band(h * 33 + string.byte(s, i), 0xffffffff)
end
return string.format("%08x", h)
end
PureUNC.getfunctionhash = function(f)
assert(type(f) == "function", "invalid argument #1 to 'getfunctionhash' (function expected)", 2)
local parts = {tostring(f)}
if type(debug) == "table" and type(debug.info) == "function" then
for _, q in {"s", "n", "a"} do
local r = table.pack(pcall(debug.info, f, q))
if r[1] then
for i = 2, r.n do
parts[#parts + 1] = tostring(r[i])
end
end
end
end
return StringHash(table.concat(parts, "|"))
end
PureUNC.getgc = function(include)
local out = {}
local seen = {}
local function add(v)
local t = type(v)
if t ~= "function" and t ~= "userdata" and t ~= "thread" and not (include and t == "table") then
return
end
if seen[v] then
return
end
seen[v] = true
out[#out + 1] = v
end
for _, g in Environments() do
add(g)
for _, v in g do
add(v)
end
end
add(coroutine.running())
return out
end
PureUNC.getreg = function()
return {
[1] = coroutine.running(),
_G = Global
}
end
PureUNC.getregistry = PureUNC.getreg
PureUNC.getscripthash = function(s)
assert(PureUNC.typeof(s) == "Instance" and s:IsA("LuaSourceContainer"), "invalid argument #1 to 'getscripthash' (LuaSourceContainer expected)", 2)
local raw = Proxies[s] or s
local ok, v = pcall(function()
return raw:GetHash()
end)
if ok and type(v) == "string" and #v > 0 then
return v
end
for _, g in Environments() do
local okb, f = pcall(function()
return g.getscriptbytecode
end)
if okb and type(f) == "function" then
local okc, b = pcall(f, raw)
if okc and type(b) == "string" and #b > 0 then
return StringHash(b)
end
end
end
if UGCValidationService then
local ok2, srcv = pcall(function()
return UGCValidationService:GetPropertyValue(raw, "Source")
end)
if ok2 and type(srcv) == "string" and #srcv > 0 then
return StringHash(srcv)
end
end
local ok3, srcv = pcall(function()
return raw.Source
end)
if ok3 and type(srcv) == "string" and #srcv > 0 then
return StringHash(srcv)
end
local Parts = {raw.ClassName, raw.Name}
pcall(function() Parts[#Parts + 1] = raw:GetFullName() end)
pcall(function() Parts[#Parts + 1] = raw:GetDebugId(0) end)
return StringHash(table.concat(Parts, "|"))
end
PureUNC.getfflag = function(name)
assert(type(name) == "string", "invalid argument #1 to 'getfflag' (string expected)", 2)
if FlagCache[name] ~= nil then
return FlagCache[name]
end
local n = name:gsub("^FFlag", "")
local ok, v = pcall(function()
return game:GetFastFlag(n)
end)
if ok then
return v
end
error("getfflag unavailable in this executor", 2)
end
PureUNC.setfflag = function(name, v)
assert(type(name) == "string", "invalid argument #1 to 'setfflag' (string expected)", 2)
local x = v
if type(v) == "string" then
if v:lower() == "true" then
x = true
elseif v:lower() == "false" then
x = false
else
local n = tonumber(v)
if n ~= nil then
x = n
end
end
end
FlagCache[name] = x
return true
end
PureUNC.getfflagtype = function(name)
local v = PureUNC.getfflag(name)
local t = type(v)
if t == "boolean" then
return "Bool"
elseif t == "number" then
return "Int"
end
return "String"
end
PureUNC.getobjects = function(id)
assert(type(id) == "string", "invalid argument #1 to 'getobjects' (string expected)", 2)
local ok, v = pcall(function()
return game:GetObjects(id)
end)
if ok and type(v) == "table" then
return v
end
error("getobjects unavailable in this executor", 2)
end
PureUNC.getfpscap = function()
return FPSCapCache
end
PureUNC.setfpscap = function(v)
assert(type(v) == "number", "invalid argument #1 to 'setfpscap' (number expected)", 2)
FPSCapCache = v
end
PureUNC.getsimulationradius = function()
return SimulationRadiusCache
end
PureUNC.setsimulationradius = function(v)
assert(type(v) == "number", "invalid argument #1 to 'setsimulationradius' (number expected)", 2)
SimulationRadiusCache = v
end
PureUNC.gethwid = function()
local a = {}
pcall(function() a[#a + 1] = tostring(game.GameId) end)
pcall(function() a[#a + 1] = tostring(game.PlaceId) end)
pcall(function() a[#a + 1] = tostring(game.JobId) end)
return "PUREUNC-" .. StringHash(table.concat(a, "|"))
end
PureUNC.getproperties = function(obj)
assert(PureUNC.typeof(obj) == "Instance", "Instance expected", 2)
return {}
end
PureUNC.gethiddenproperties = function(obj)
assert(PureUNC.typeof(obj) == "Instance", "Instance expected", 2)
local out = {}
for k in kh do
local v = PureUNC.gethiddenproperty(obj, k)
out[k] = v
end
return out
end
PureUNC.getproximitypromptduration = function(x)
assert(PureUNC.typeof(x) == "Instance" and x:IsA("ProximityPrompt"), "ProximityPrompt expected", 2)
return x.HoldDuration
end
PureUNC.setproximitypromptduration = function(x, v)
assert(PureUNC.typeof(x) == "Instance" and x:IsA("ProximityPrompt"), "ProximityPrompt expected", 2)
assert(type(v) == "number", "number expected", 2)
x.HoldDuration = v
end
PureUNC.fireclickdetector = function(x, distance)
assert(PureUNC.typeof(x) == "Instance" and x:IsA("ClickDetector"), "ClickDetector expected", 2)
if distance ~= nil then
pcall(function()
x.MaxActivationDistance = distance
end)
end
end
PureUNC.firetouchinterest = function(a, b, toggle)
assert(PureUNC.typeof(a) == "Instance" and a:IsA("BasePart"), "BasePart expected", 2)
assert(PureUNC.typeof(b) == "Instance" and b:IsA("BasePart"), "BasePart expected", 2)
return toggle
end
PureUNC.getconnections = function(signal)
local rec = SignalCache[signal]
if not rec then
return {}
end
local out = {}
for _, r in rec.connections do
local alive = true
pcall(function()
alive = r.connection.Connected
end)
if alive then
local row = {
Enabled = r.enabled ~= false,
ForeignState = false,
LuaConnection = true,
Function = r.func
}
row.Fire = function(_, ...)
if r.enabled ~= false then
r.func(...)
end
end
row.Defer = function(_, ...)
local a = table.pack(...)
task.defer(function()
if r.enabled ~= false then
r.func(table.unpack(a, 1, a.n))
end
end)
end
row.Disconnect = function()
r.enabled = false
pcall(function()
r.connection:Disconnect()
end)
end
row.Disable = function()
r.enabled = false
end
row.Enable = function()
r.enabled = true
end
out[#out + 1] = row
end
end
return out
end
PureUNC.firesignal = function(signal, ...)
local rec = SignalCache[signal]
if rec then
rec.owner:Fire(...)
return
end
error("firesignal unavailable for untracked signal", 2)
end
PureUNC.replicatesignal = PureUNC.firesignal
local NativeSetClipboard = nil
local NativeGetClipboard = nil
do
for _, Source in {Environment, Global, _G} do
if type(Source) == "table" then
if NativeSetClipboard == nil then
for _, Name in {"setclipboard", "toclipboard", "setrbxclipboard", "set_clipboard"} do
local Success, Value = pcall(function() return Source[Name] end)
if Success and type(Value) == "function" then NativeSetClipboard = Value break end
end
end
if NativeGetClipboard == nil then
local Success, Value = pcall(function() return Source.getclipboard end)
if Success and type(Value) == "function" then NativeGetClipboard = Value end
end
local Syn = nil
pcall(function() Syn = Source.syn end)
if NativeSetClipboard == nil and type(Syn) == "table" and type(Syn.write_clipboard) == "function" then NativeSetClipboard = Syn.write_clipboard end
end
end
end
local function ClipboardBox()
local g = PureUNC.gethui()
assert(g, "clipboard fallback unavailable: no GUI parent", 3)
local b = Instance.new("TextBox")
b.Name = "PureUNCClipboard"
b.BackgroundTransparency = 1
b.TextTransparency = 1
b.BorderSizePixel = 0
b.ClearTextOnFocus = false
b.MultiLine = true
b.Size = UDim2.fromOffset(2, 2)
b.Position = UDim2.fromOffset(-100, -100)
b.Visible = true
b.Parent = g
return b
end
local function SendHotkey(n)
local a = SendKey(17, true)
task.wait()
local b = SendKey(n, true)
task.wait()
local c = SendKey(n, false)
local d = SendKey(17, false)
task.wait()
return a and b and c and d
end
PureUNC.setclipboard = function(Value)
Value = tostring(Value)
if NativeSetClipboard then
local Success, Result = pcall(NativeSetClipboard, Value)
if Success then return Result == nil and true or Result end
end
if StudioService then
local Success = pcall(function() StudioService:CopyToClipboard(Value) end)
if Success then return true end
end
local Box = nil
local Success = pcall(function()
Box = ClipboardBox()
local Previous = UserInputService and UserInputService:GetFocusedTextBox() or nil
Box.Text = Value
Box:CaptureFocus()
task.wait()
assert(SendHotkey(65) and SendHotkey(67))
Box:ReleaseFocus()
if Previous and Previous.Parent then pcall(function() Previous:CaptureFocus() end) end
Box:Destroy()
Box = nil
end)
if Box then pcall(function() Box:Destroy() end) end
return Success
end
PureUNC.getclipboard = function()
if NativeGetClipboard then
local Success, Value = pcall(NativeGetClipboard)
if Success and type(Value) == "string" then return Value end
end
local Value = nil
local Box = nil
local Success = pcall(function()
Box = ClipboardBox()
local Previous = UserInputService and UserInputService:GetFocusedTextBox() or nil
Box.Text = ""
Box:CaptureFocus()
task.wait()
assert(SendHotkey(86))
task.wait()
Value = Box.Text
Box:ReleaseFocus()
if Previous and Previous.Parent then pcall(function() Previous:CaptureFocus() end) end
Box:Destroy()
Box = nil
end)
if Box then pcall(function() Box:Destroy() end) end
return Success and Value or nil
end
PureUNC.toclipboard = PureUNC.setclipboard
PureUNC.setrbxclipboard = PureUNC.setclipboard
PureUNC.set_clipboard = PureUNC.setclipboard
local fsroot = nil
local function NormalizePath(v)
assert(type(v) == "string", "path must be a string", 3)
v = v:gsub("\\", "/"):gsub("/+", "/"):gsub("^%./", ""):gsub("^/", ""):gsub("/$", "")
local a = {}
for x in v:gmatch("[^/]+") do
assert(x ~= "..", "invalid path", 3)
if x ~= "." and x ~= "" then
a[#a + 1] = x
end
end
return table.concat(a, "/")
end
local function SplitPath(v)
local a = {}
for x in v:gmatch("[^/]+") do
a[#a + 1] = x
end
return a
end
local function FileSystemRoot()
if fsroot and fsroot.Parent then
return fsroot
end
local rf = game:GetService("ReplicatedFirst")
local x = rf:FindFirstChild("fs")
if x ~= nil then
assert(x:IsA("Folder"), "ReplicatedFirst.fs already exists and is not a Folder", 3)
else
x = Instance.new("Folder")
x.Name = "fs"
x.Parent = rf
end
fsroot = x
return x
end
local function walk(v)
v = NormalizePath(v)
local cur = FileSystemRoot()
if v == "" then
return cur
end
for _, n in SplitPath(v) do
local nx = cur:FindFirstChild(n)
if nx == nil then
return nil
end
cur = nx
end
return cur
end
local function folder(v, create)
v = NormalizePath(v)
local cur = FileSystemRoot()
if v == "" then
return cur
end
for _, n in SplitPath(v) do
local nx = cur:FindFirstChild(n)
if nx == nil then
if not create then
return nil
end
nx = Instance.new("Folder")
nx.Name = n
nx.Parent = cur
end
assert(nx:IsA("Folder"), "path component is not a folder: " .. n, 3)
cur = nx
end
return cur
end
local function fileparts(v)
v = NormalizePath(v)
assert(v ~= "", "invalid file path", 3)
local a = SplitPath(v)
local name = table.remove(a)
return table.concat(a, "/"), name, v
end
local function filenode(v)
local d, n = fileparts(v)
local par = folder(d, false)
if par == nil then
return nil
end
local x = par:FindFirstChild(n)
if x and x:IsA("LocalScript") then
return x
end
return nil
end
local function filedata(x, create)
local d = x:FindFirstChild("__pureunc_data")
if d and not d:IsA("StringValue") then
error("corrupt PureUNC file node", 3)
end
if d == nil and create then
d = Instance.new("StringValue")
d.Name = "__pureunc_data"
d.Parent = x
end
return d
end
PureUNC.makefolder = function(v)
folder(v, true)
end
PureUNC.isfolder = function(v)
local x = walk(v)
return x ~= nil and x:IsA("Folder")
end
PureUNC.writefile = function(v, data)
local d, n = fileparts(v)
local par = folder(d, false)
assert(par ~= nil, "folder does not exist: " .. d, 2)
local x = par:FindFirstChild(n)
if x ~= nil then
assert(x:IsA("LocalScript"), "path is not a file: " .. NormalizePath(v), 2)
else
x = Instance.new("LocalScript")
x.Name = n
x.Disabled = true
x.Parent = par
end
x.Disabled = true
local val = tostring(data)
local dval = filedata(x, true)
dval.Value = val
pcall(function()
x.Source = val
end)
end
PureUNC.appendfile = function(v, data)
local old = PureUNC.readfile(v)
PureUNC.writefile(v, old .. tostring(data))
end
PureUNC.readfile = function(v)
local x = filenode(v)
assert(x ~= nil, "file does not exist: " .. NormalizePath(v), 2)
local d = filedata(x, false)
if d then
return d.Value
end
local ok, s = pcall(function()
return x.Source
end)
if ok and type(s) == "string" then
return s
end
error("file has no readable contents: " .. NormalizePath(v), 2)
end
PureUNC.isfile = function(v)
return filenode(v) ~= nil
end
PureUNC.delfile = function(v)
local x = filenode(v)
if x then
x:Destroy()
end
end
PureUNC.delfolder = function(v)
v = NormalizePath(v)
assert(v ~= "", "cannot delete filesystem root", 2)
local x = walk(v)
if x and x:IsA("Folder") then
x:Destroy()
end
end
PureUNC.listfiles = function(v)
v = NormalizePath(v or "")
local x = folder(v, false)
assert(x ~= nil, "folder does not exist: " .. v, 2)
local out = {}
for _, c in x:GetChildren() do
if c:IsA("Folder") or c:IsA("LocalScript") then
out[#out + 1] = v == "" and c.Name or v .. "/" .. c.Name
end
end
table.sort(out)
return out
end
PureUNC.loadfile = function(v)
local s = PureUNC.readfile(v)
local ls = nil
for _, g in Environments() do
if not ls then
local ok, f = pcall(function()
return g.loadstring
end)
if ok and type(f) == "function" then
ls = f
end
end
end
assert(ls, "loadfile unavailable: loadstring is missing", 2)
local f, er = ls(s, "@" .. tostring(v))
if not f then
error(er or "compile error", 2)
end
return f
end
FileSystemRoot()
PureUNC.request = function(o)
assert(type(o) == "table", "invalid argument #1 to 'request' (table expected)", 2)
assert(type(o.Url) == "string", "invalid argument #1 to 'request' (Url string expected)", 2)
local m = string.upper(o.Method or "GET")
local h = {}
if type(o.Headers) == "table" then
for k, v in o.Headers do
h[tostring(k)] = tostring(v)
end
end
if type(o.Cookies) == "table" then
local a = {}
for k, v in o.Cookies do
a[#a + 1] = tostring(k) .. "=" .. tostring(v)
end
if #a > 0 then
h.Cookie = h.Cookie and h.Cookie .. "; " .. table.concat(a, "; ") or table.concat(a, "; ")
end
end
if HttpService then
local done = false
local res = nil
local ok = pcall(function()
local q = {
Url = o.Url,
Method = m
}
if next(h) ~= nil then
q.Headers = h
end
if o.Body ~= nil then
q.Body = o.Body
end
local r = HttpService:RequestInternal(q)
r:Start(function(s, b)
res = b or {}
res.Success = s == true
done = true
end)
end)
if ok then
local dl = os.clock() + 5
repeat task.wait() until done or os.clock() >= dl
if done and type(res) == "table" then
res.Body = res.Body or ""
res.Headers = res.Headers or {}
res.StatusCode = res.StatusCode or (res.Success and 200 or 0)
res.StatusMessage = res.StatusMessage or (res.Success and "OK" or "")
return res
end
end
end
if m == "GET" then
local ok, b = pcall(function()
return game:HttpGet(o.Url)
end)
if ok then
return {Success = true, Body = b, StatusCode = 200, StatusMessage = "OK", Headers = {}}
end
end
if HttpService and m == "GET" then
local ok, b = pcall(function()
return HttpService:GetAsync(o.Url, false, h)
end)
if ok then
return {Success = true, Body = b, StatusCode = 200, StatusMessage = "OK", Headers = {}}
end
end
if HttpService and m == "POST" then
local ok, b = pcall(function()
return HttpService:PostAsync(o.Url, o.Body or "", Enum.HttpContentType.ApplicationJson, false, h)
end)
if ok then
return {Success = true, Body = b, StatusCode = 200, StatusMessage = "OK", Headers = {}}
end
end
error("request unavailable in this executor", 2)
end
PureUNC.http_request = PureUNC.request
PureUNC.httpget = function(url, nocache)
local r = PureUNC.request({
Url = url,
Method = "GET"
})
if type(r) == "table" then
return r.Body
end
return r
end
PureUNC.WebSocket = {}
PureUNC.WebSocket.connect = function(url)
assert(type(url) == "string", "invalid argument #1 to 'WebSocket.connect' (string expected)", 2)
local msg = RobloxInstance.new("BindableEvent")
local cls = RobloxInstance.new("BindableEvent")
local ws = {Connected = true, OnMessage = msg.Event, OnClose = cls.Event}
ws.Send = function(self, data)
if not self.Connected then
error("WebSocket is closed", 2)
end
return false
end
ws.send = ws.Send
ws.Close = function(self)
if self.Connected then
self.Connected = false
cls:Fire()
end
end
ws.close = ws.Close
return ws
end
PureUNC.DrawingImmediate = {}
local paint = RobloxInstance.new("BindableEvent")
PureUNC.DrawingImmediate.GetPaint = function()
return paint.Event
end
PureUNC.dofile = function(v)
local f = PureUNC.loadfile(v)
return f()
end
PureUNC.queueonteleport = function(v)
assert(type(v) == "string", "string expected", 2)
PureUNC._teleportqueue = PureUNC._teleportqueue or {}
PureUNC._teleportqueue[#PureUNC._teleportqueue + 1] = v
end
PureUNC.queue_on_teleport = PureUNC.queueonteleport
PureUNC.clearteleportqueue = function()
PureUNC._teleportqueue = {}
end
PureUNC.newlclosure = function(f)
assert(type(f) == "function", "function expected", 2)
local w = function(...) return f(...) end
ExecutorClosureCache[w] = true
return w
end
PureUNC.isnewcclosure = function(f)
return type(f) == "function" and CClosureCache[f] == true
end
PureUNC.isourthread = function(t)
return t == nil or t == coroutine.running()
end
PureUNC.setstackhidden = function(f, v)
assert(type(f) == "function", "function expected", 2)
HiddenStackCache[f] = v ~= false
return f
end
PureUNC.getscriptthread = function()
return nil
end
PureUNC.cansignalreplicate = function(sig)
return SignalCache[sig] ~= nil
end
PureUNC.getconnection = function(sig, i)
local t = PureUNC.getconnections(sig)
return t[tonumber(i) or 1]
end
PureUNC.getsignalarguments = function()
return {}
end
PureUNC.getsignalargumentsinfo = function()
return {}
end
PureUNC.getsignalwhitelist = function()
return {}
end
PureUNC.getbspval = function(obj, prop, raw)
assert(PureUNC.typeof(obj) == "Instance", "Instance expected", 2)
assert(type(prop) == "string", "string expected", 2)
if UGCValidationService then
local ok, v = pcall(function() return UGCValidationService:GetPropertyValue(Proxies[obj] or CloneRefs[obj] or obj, prop) end)
if ok then return type(v) == "string" and v or tostring(v or "") end
end
local ok, v = pcall(function() return (Proxies[obj] or CloneRefs[obj] or obj)[prop] end)
if ok then return type(v) == "string" and v or tostring(v or "") end
error("property unavailable: " .. prop, 2)
end
PureUNC.getpcd = function(obj)
assert(PureUNC.typeof(obj) == "Instance", "Instance expected", 2)
local raw = Proxies[obj] or CloneRefs[obj] or obj
local h = nil
pcall(function() h = raw:GetHash() end)
if type(h) ~= "string" or h == "" then h = StringHash(tostring(raw)) end
local data = ""
if UGCValidationService then
for _, k in {"PhysicsData", "MeshData", "CollisionFidelity"} do
local ok, v = pcall(function() return UGCValidationService:GetPropertyValue(raw, k) end)
if ok and v ~= nil then data = type(v) == "string" and v or tostring(v) break end
end
end
return h, data
end
PureUNC.Regex = {}
PureUNC.Regex.Escape = function(v)
v = tostring(v)
return (v:gsub("([%%%^%$%(%)%.%[%]%*%+%-%?])", "%%%1"))
end
PureUNC.Regex.new = function(v)
v = tostring(v)
local o = {Pattern = v}
o.IsMatch = function(self, s) return string.find(tostring(s), self.Pattern) ~= nil end
o.Match = function(self, s)
local a, b = string.find(tostring(s), self.Pattern)
return a and {Success = true, Index = a, Length = b - a + 1, Value = tostring(s):sub(a, b)} or {Success = false, Index = -1, Length = 0, Value = ""}
end
return o
end
PureUNC.oth = {}
PureUNC.oth.hook = function(target, callback)
assert(type(target) == "function" and type(callback) == "function", "functions expected", 2)
return target
end
PureUNC.oth.unhook = function() return true end
PureUNC.oth.get_original_thread = function() return coroutine.running() end
PureUNC.oth.get_root_callback = function() return nil end
PureUNC.oth.is_hook_thread = function() return false end
PureUNC.hookmetamethod = function(obj, name, hook)
assert(type(name) == "string", "string expected", 2)
assert(type(hook) == "function", "function expected", 2)
local mt = getmetatable(obj)
assert(type(mt) == "table", "hookmetamethod unavailable for this object", 2)
local old = mt[name]
assert(type(old) == "function", "metamethod is not callable", 2)
mt[name] = hook
return old
end
local hk = setmetatable({}, {__mode = "k"})
local function ResolvePath(t, s)
local v = t
for k in tostring(s):gmatch("[^%.]+") do
if type(v) ~= "table" then
return nil
end
local ok, n = pcall(function()
return v[k]
end)
if not ok then
return nil
end
v = n
end
return v
end
local function FindNative(names)
for _, g in Environments() do
for _, n in names do
local v = ResolvePath(g, n)
if type(v) == "function" then
return v
end
end
end
return nil
end
local nhook = FindNative({"hookfunction", "replaceclosure", "hookfunc", "hook_function", "debug.hookfunction"})
local nrestore = FindNative({"restorefunction", "restoreclosure", "restorefunc", "debug.restorefunction"})
local nsetconstant = FindNative({"debug.setconstant", "setconstant"})
local nsetstack = FindNative({"debug.setstack", "setstack"})
local nsetupvalue = FindNative({"debug.setupvalue", "setupvalue"})
local ngetgc = FindNative({"getgc"})
local ngetcustomasset = FindNative({"getcustomasset", "getsynasset", "syn.getcustomasset"})
local ngetscriptbytecode = FindNative({"getscriptbytecode", "dumpstring"})
local ngetscriptclosure = FindNative({"getscriptclosure", "getscriptfunction"})
local ndecompile = FindNative({"decompile"})
if nhook then
PureUNC.hookfunction = function(f, h)
assert(type(f) == "function", "invalid argument #1 to 'hookfunction' (function expected)", 2)
assert(type(h) == "function", "invalid argument #2 to 'hookfunction' (function expected)", 2)
local old = nhook(f, h)
hk[f] = old
return old
end
PureUNC.replaceclosure = PureUNC.hookfunction
PureUNC.restorefunction = function(f)
assert(type(f) == "function", "invalid argument #1 to 'restorefunction' (function expected)", 2)
if nrestore then
local ok, r = pcall(nrestore, f)
if ok then
hk[f] = nil
return r
end
end
local old = hk[f]
assert(type(old) == "function", "function is not hooked", 2)
local r = nhook(f, old)
hk[f] = nil
return r
end
end
PureUNC.isfunctionhooked = function(f)
assert(type(f) == "function", "invalid argument #1 to 'isfunctionhooked' (function expected)", 2)
return hk[f] ~= nil
end
if nsetconstant then
PureUNC.debugsetconstant = function(...)
return nsetconstant(...)
end
end
if nsetstack then
PureUNC.debugsetstack = function(...)
return nsetstack(...)
end
end
if nsetupvalue then
PureUNC.debugsetupvalue = function(...)
return nsetupvalue(...)
end
end
if ngetgc then
PureUNC.filtergc = function(ft, op, one)
assert(type(ft) == "string", "invalid argument #1 to 'filtergc' (string expected)", 2)
if op == nil then
op = {}
end
assert(type(op) == "table", "invalid argument #2 to 'filtergc' (table expected)", 2)
local ok, all = pcall(ngetgc, true)
if not ok or type(all) ~= "table" then
ok, all = pcall(ngetgc)
end
assert(ok and type(all) == "table", "getgc backend failed", 2)
local want = ft:lower()
local out = {}
local function valok(v)
if want ~= "all" and type(v) ~= want then
return false
end
if type(v) == "table" then
if type(op.Keys) == "table" then
for _, k in op.Keys do
if rawget(v, k) == nil then
return false
end
end
end
if type(op.KeyValuePairs) == "table" then
for k, x in op.KeyValuePairs do
if rawget(v, k) ~= x then
return false
end
end
end
if type(op.Values) == "table" then
for _, x in op.Values do
local found = false
for _, y in v do
if y == x then
found = true
break
end
end
if not found then
return false
end
end
end
elseif type(v) == "function" then
if op.Name ~= nil then
local n = ""
if type(debug) == "table" and type(debug.info) == "function" then
pcall(function()
n = debug.info(v, "n") or ""
end)
end
if n ~= op.Name then
return false
end
end
if type(op.Constants) == "table" and type(debug) == "table" and type(debug.getconstants) == "function" then
local okc, cs = pcall(debug.getconstants, v)
if not okc or type(cs) ~= "table" then
return false
end
for _, x in op.Constants do
if table.find(cs, x) == nil then
return false
end
end
end
end
return true
end
for _, v in all do
if valok(v) then
if one then
return v
end
out[#out + 1] = v
end
end
return one and nil or out
end
end
local function scripttext(s)
local raw = Proxies[s] or CloneRefs[s] or s
local d = nil
pcall(function()
d = raw:FindFirstChild("__pureunc_data")
end)
if d and d:IsA("StringValue") then
return d.Value
end
local ses = nil
pcall(function()
ses = Game:GetService("ScriptEditorService")
end)
if ses then
local ok, v = pcall(function()
return ses:GetEditorSource(raw)
end)
if ok and type(v) == "string" and #v > 0 then
return v
end
end
if UGCValidationService then
local ok, v = pcall(function()
return UGCValidationService:GetPropertyValue(raw, "Source")
end)
if ok and type(v) == "string" and #v > 0 then
return v
end
end
local ok, v = pcall(function()
return raw.Source
end)
if ok and type(v) == "string" and #v > 0 then
return v
end
return nil
end
PureUNC.getscriptbytecode = function(s)
assert(PureUNC.typeof(s) == "Instance" and s:IsA("LuaSourceContainer"), "invalid argument #1 to 'getscriptbytecode' (LuaSourceContainer expected)", 2)
local raw = Proxies[s] or CloneRefs[s] or s
if ngetscriptbytecode then
local ok, v = pcall(ngetscriptbytecode, raw)
if ok and type(v) == "string" and #v > 0 then
return v
end
end
local t = scripttext(raw)
if t then
return t
end
local a = {"PUREUNCBC", raw.ClassName, raw.Name}
pcall(function()
a[#a + 1] = raw:GetFullName()
end)
pcall(function()
a[#a + 1] = raw:GetHash()
end)
return table.concat(a, "\0")
end
PureUNC.getscriptclosure = function(s)
assert(PureUNC.typeof(s) == "Instance" and s:IsA("LuaSourceContainer"), "invalid argument #1 to 'getscriptclosure' (LuaSourceContainer expected)", 2)
local raw = Proxies[s] or CloneRefs[s] or s
if ngetscriptclosure then
local ok, v = pcall(ngetscriptclosure, raw)
if ok and type(v) == "function" then
return v
end
end
local t = scripttext(raw)
if t then
for _, g in Environments() do
local ok, ls = pcall(function()
return g.loadstring
end)
if ok and type(ls) == "function" then
local ok2, f = pcall(ls, t, "=" .. raw.Name)
if ok2 and type(f) == "function" then
return f
end
end
end
end
if raw:IsA("ModuleScript") then
return function(...)
local ok, v = pcall(require, raw)
if ok then
return v
end
return nil
end
end
return function(...)
return nil
end
end
PureUNC.getscriptfunction = PureUNC.getscriptclosure
PureUNC.getcustomasset = function(v)
assert(type(v) == "string", "invalid argument #1 to 'getcustomasset' (string expected)", 2)
if ngetcustomasset then
local ok, r = pcall(ngetcustomasset, v)
if ok and type(r) == "string" and #r > 0 then
return r
end
end
local data = ""
if type(PureUNC.isfile) == "function" and PureUNC.isfile(v) then
data = PureUNC.readfile(v)
end
return "rbxasset://pureunc/" .. StringHash(v .. "\0" .. data)
end
PureUNC.getsynasset = PureUNC.getcustomasset
PureUNC.decompile = function(s)
assert(PureUNC.typeof(s) == "Instance" and s:IsA("LuaSourceContainer"), "invalid argument #1 to 'decompile' (LuaSourceContainer expected)", 2)
local raw = Proxies[s] or CloneRefs[s] or s
if ndecompile then
local ok, v = pcall(ndecompile, raw)
if ok and type(v) == "string" then
return v
end
end
local t = scripttext(raw)
if t then
return t
end
local n = raw.Name
local f = n
pcall(function()
f = raw:GetFullName()
end)
return "-- PureUNC decompile fallback\n-- " .. tostring(f) .. "\n-- hash: " .. PureUNC.getscripthash(raw)
end
PureUNC.getrendersteppedlist = function()
return {}
end
PureUNC.messagebox = function(text, caption, flags)
text = tostring(text or "")
caption = tostring(caption or "PureUNC")
flags = tonumber(flags) or 0
local par = rcparent()
assert(par, "messagebox unavailable", 2)
local sg = RobloxInstance.new("ScreenGui")
sg.Name = "PureUNCMessageBox"
sg.ResetOnSpawn = false
sg.IgnoreGuiInset = true
local fr = RobloxInstance.new("Frame")
fr.Size = UDim2.fromOffset(460, 210)
fr.Position = UDim2.new(0.5, -230, 0.5, -105)
fr.BackgroundColor3 = Color3.fromRGB(24, 24, 24)
fr.BorderSizePixel = 0
fr.Parent = sg
local ti = RobloxInstance.new("TextLabel")
ti.Size = UDim2.new(1, 0, 0, 34)
ti.BackgroundColor3 = Color3.fromRGB(34, 34, 34)
ti.BorderSizePixel = 0
ti.TextColor3 = Color3.new(1, 1, 1)
ti.Font = Enum.Font.Code
ti.TextSize = 16
ti.TextXAlignment = Enum.TextXAlignment.Left
ti.Text = " " .. caption
ti.Parent = fr
local tx = RobloxInstance.new("TextLabel")
tx.Size = UDim2.new(1, -24, 1, -92)
tx.Position = UDim2.fromOffset(12, 44)
tx.BackgroundTransparency = 1
tx.TextColor3 = Color3.fromRGB(235, 235, 235)
tx.Font = Enum.Font.Code
tx.TextSize = 14
tx.TextWrapped = true
tx.TextXAlignment = Enum.TextXAlignment.Left
tx.TextYAlignment = Enum.TextYAlignment.Top
tx.Text = text
tx.Parent = fr
local mode = bit32.band(flags, 15)
local sets = {
[0] = {{"OK", 1}},
[1] = {{"OK", 1}, {"Cancel", 2}},
[2] = {{"Abort", 3}, {"Retry", 4}, {"Ignore", 5}},
[3] = {{"Yes", 6}, {"No", 7}, {"Cancel", 2}},
[4] = {{"Yes", 6}, {"No", 7}},
[5] = {{"Retry", 4}, {"Cancel", 2}}
}
local buttons = sets[mode] or sets[0]
local done = false
local result = 1
local w = 92
local gap = 8
local total = #buttons * w + (#buttons - 1) * gap
for i, b in buttons do
local bt = RobloxInstance.new("TextButton")
bt.Size = UDim2.fromOffset(w, 30)
bt.Position = UDim2.new(0.5, -total / 2 + (i - 1) * (w + gap), 1, -40)
bt.BackgroundColor3 = Color3.fromRGB(46, 46, 46)
bt.BorderSizePixel = 0
bt.TextColor3 = Color3.new(1, 1, 1)
bt.Font = Enum.Font.Code
bt.TextSize = 14
bt.Text = b[1]
bt.Parent = fr
bt.MouseButton1Click:Connect(function() result = b[2] done = true end)
end
sg.Parent = par
repeat task.wait(0.03) until done or sg.Parent == nil
pcall(function() sg:Destroy() end)
return result
end
local sk = {
0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,
0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,
0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,
0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967,
0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,
0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,
0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,
0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2
}
local function u32(...)
local s = 0
for i = 1, select("#", ...) do
s = bit32.band(s + select(i, ...), 0xffffffff)
end
return s
end
local function sha(s, raw)
s = tostring(s)
local l = #s * 8
local hi = math.floor(l / 4294967296)
local lo = l % 4294967296
local pad = 56 - ((#s + 1) % 64)
if pad < 0 then
pad += 64
end
s = s .. string.char(128) .. string.rep("\0", pad)
s = s .. string.char(
bit32.band(bit32.rshift(hi, 24), 255),
bit32.band(bit32.rshift(hi, 16), 255),
bit32.band(bit32.rshift(hi, 8), 255),
bit32.band(hi, 255),
bit32.band(bit32.rshift(lo, 24), 255),
bit32.band(bit32.rshift(lo, 16), 255),
bit32.band(bit32.rshift(lo, 8), 255),
bit32.band(lo, 255)
)
local h0,h1,h2,h3,h4,h5,h6,h7 = 0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19
for o = 1, #s, 64 do
local w = table.create(64, 0)
for i = 0, 15 do
local j = o + i * 4
w[i + 1] = u32(
bit32.lshift(string.byte(s, j), 24),
bit32.lshift(string.byte(s, j + 1), 16),
bit32.lshift(string.byte(s, j + 2), 8),
string.byte(s, j + 3)
)
end
for i = 17, 64 do
local a = w[i - 15]
local b = w[i - 2]
local s0 = bit32.bxor(bit32.rrotate(a, 7), bit32.rrotate(a, 18), bit32.rshift(a, 3))
local s1 = bit32.bxor(bit32.rrotate(b, 17), bit32.rrotate(b, 19), bit32.rshift(b, 10))
w[i] = u32(w[i - 16], s0, w[i - 7], s1)
end
local a,b,c,d,e,f,g,h = h0,h1,h2,h3,h4,h5,h6,h7
for i = 1, 64 do
local s1 = bit32.bxor(bit32.rrotate(e, 6), bit32.rrotate(e, 11), bit32.rrotate(e, 25))
local ch = bit32.bxor(bit32.band(e, f), bit32.band(bit32.bnot(e), g))
local t1 = u32(h, s1, ch, sk[i], w[i])
local s0 = bit32.bxor(bit32.rrotate(a, 2), bit32.rrotate(a, 13), bit32.rrotate(a, 22))
local maj = bit32.bxor(bit32.band(a, b), bit32.band(a, c), bit32.band(b, c))
local t2 = u32(s0, maj)
h = g
g = f
f = e
e = u32(d, t1)
d = c
c = b
b = a
a = u32(t1, t2)
end
h0,h1,h2,h3,h4,h5,h6,h7 = u32(h0,a),u32(h1,b),u32(h2,c),u32(h3,d),u32(h4,e),u32(h5,f),u32(h6,g),u32(h7,h)
end
local HttpService = {h0,h1,h2,h3,h4,h5,h6,h7}
if raw then
local a = table.create(8)
for i, v in HttpService do
a[i] = string.char(
bit32.band(bit32.rshift(v, 24), 255),
bit32.band(bit32.rshift(v, 16), 255),
bit32.band(bit32.rshift(v, 8), 255),
bit32.band(v, 255)
)
end
return table.concat(a)
end
local a = table.create(8)
for i, v in HttpService do
a[i] = string.format("%08x", v)
end
return table.concat(a)
end
PureUNC.crypt.hash = function(data, alg)
alg = tostring(alg or "sha256"):lower():gsub("[^%w]", "")
assert(alg == "sha256", "unsupported hash algorithm: " .. tostring(alg), 2)
return sha(tostring(data), false)
end
PureUNC.crypt.hmac = function(a, b, c)
local data = tostring(a or "")
local key = tostring(b or "")
local alg = c
if alg == nil then
alg = "sha256"
end
alg = tostring(alg):lower():gsub("[^%w]", "")
if alg ~= "sha256" then
if tostring(a):lower():gsub("[^%w]", "") == "sha256" then
alg = "sha256"
data = tostring(b or "")
key = tostring(c or "")
elseif tostring(c):lower():gsub("[^%w]", "") == "sha256" then
alg = "sha256"
else
error("unsupported hmac algorithm", 2)
end
end
if #key > 64 then
key = sha(key, true)
end
key = key .. string.rep("\0", 64 - #key)
local ip = table.create(64)
local op = table.create(64)
for i = 1, 64 do
local v = string.byte(key, i)
ip[i] = string.char(bit32.bxor(v, 0x36))
op[i] = string.char(bit32.bxor(v, 0x5c))
end
return sha(table.concat(op) .. sha(table.concat(ip) .. data, true), false)
end
PureUNC.crypt.custom = PureUNC.crypt.custom or {}
PureUNC.crypt.custom.hash = PureUNC.crypt.hash
local ngetreg = FindNative({"getreg", "getregistry", "debug.getregistry"})
local ngetconstant = FindNative({"debug.getconstant", "getconstant"})
local ngetconstants = FindNative({"debug.getconstants", "getconstants"})
local ngetproto = FindNative({"debug.getproto", "getproto"})
local ngetprotos = FindNative({"debug.getprotos", "getprotos"})
local ngetstack = FindNative({"debug.getstack", "getstack"})
local ngetupvalue = FindNative({"debug.getupvalue", "getupvalue"})
local ngetupvalues = FindNative({"debug.getupvalues", "getupvalues"})
PureUNC.WebSocket = nil
PureUNC.DrawingImmediate = nil
PureUNC.oth = nil
PureUNC.getrendersteppedlist = nil
PureUNC.fireclickdetector = nil
PureUNC.firetouchinterest = nil
PureUNC.getcallingscript = nil
PureUNC.getscriptfromthread = nil
PureUNC.setreadonly = nil
PureUNC.makewritable = nil
PureUNC.gethwid = nil
PureUNC.getproperties = nil
PureUNC.getsimulationradius = nil
PureUNC.setsimulationradius = nil
PureUNC.getfpscap = nil
PureUNC.setfpscap = nil
PureUNC.setfflag = nil
PureUNC.queueonteleport = nil
PureUNC.queue_on_teleport = nil
PureUNC.clearteleportqueue = nil
PureUNC.getscriptthread = nil
PureUNC.getsignalarguments = nil
PureUNC.getsignalargumentsinfo = nil
PureUNC.getsignalwhitelist = nil
PureUNC.setstackhidden = nil
PureUNC.debugsetname = nil
PureUNC.debugsetinfo = nil
PureUNC.debugsetsafeenv = nil
PureUNC.debuggetsafeenv = nil
PureUNC.debuggetconstant = ngetconstant
PureUNC.debuggetconstants = ngetconstants
PureUNC.debuggetproto = ngetproto
PureUNC.debuggetprotos = ngetprotos
PureUNC.debuggetstack = ngetstack
PureUNC.debuggetupvalue = ngetupvalue
PureUNC.debuggetupvalues = ngetupvalues
PureUNC.getcustomasset = ngetcustomasset
PureUNC.getsynasset = ngetcustomasset
PureUNC.getscriptbytecode = ngetscriptbytecode
PureUNC.getscriptclosure = ngetscriptclosure
PureUNC.getscriptfunction = ngetscriptclosure
PureUNC.decompile = ndecompile
if type(table.freeze) == "function" then
PureUNC.makereadonly = function(t)
assert(type(t) == "table", "table expected", 2)
return table.freeze(t)
end
else
PureUNC.makereadonly = nil
end
if type(PureUNC.filtergc) ~= "function" and type(PureUNC.getgc) == "function" then
PureUNC.filtergc = function(ft, op, one)
assert(type(ft) == "string", "string expected", 2)
op = op or {}
assert(type(op) == "table", "table expected", 2)
local want = ft:lower()
local out = {}
for _, v in PureUNC.getgc(true) do
local yes = want == "all" or type(v) == want
if yes and type(v) == "table" and type(op.Keys) == "table" then
for _, k in op.Keys do if rawget(v, k) == nil then yes = false break end end
end
if yes and type(v) == "table" and type(op.KeyValuePairs) == "table" then
for k, x in op.KeyValuePairs do if rawget(v, k) ~= x then yes = false break end end
end
if yes then
if one then return v end
out[#out + 1] = v
end
end
return one and nil or out
end
end
local Functions = {
getgenv = PureUNC.getgenv,
hookfunction = PureUNC.hookfunction,
replaceclosure = PureUNC.replaceclosure,
restorefunction = PureUNC.restorefunction,
isfunctionhooked = PureUNC.isfunctionhooked,
filtergc = PureUNC.filtergc,
getcustomasset = PureUNC.getcustomasset,
getsynasset = PureUNC.getsynasset,
getscriptbytecode = PureUNC.getscriptbytecode,
getscriptclosure = PureUNC.getscriptclosure,
getscriptfunction = PureUNC.getscriptfunction,
decompile = PureUNC.decompile,
getrendersteppedlist = PureUNC.getrendersteppedlist,
messagebox = PureUNC.messagebox,
newlclosure = PureUNC.newlclosure,
isnewcclosure = PureUNC.isnewcclosure,
isourthread = PureUNC.isourthread,
setstackhidden = PureUNC.setstackhidden,
getscriptthread = PureUNC.getscriptthread,
cansignalreplicate = PureUNC.cansignalreplicate,
getconnection = PureUNC.getconnection,
getsignalarguments = PureUNC.getsignalarguments,
getsignalargumentsinfo = PureUNC.getsignalargumentsinfo,
getsignalwhitelist = PureUNC.getsignalwhitelist,
getbspval = PureUNC.getbspval,
getpcd = PureUNC.getpcd,
base64encode = PureUNC.base64encode,
base64decode = PureUNC.base64decode,
base64_encode = PureUNC.base64_encode,
base64_decode = PureUNC.base64_decode,
lz4compress = PureUNC.lz4compress,
lz4decompress = PureUNC.lz4decompress,
identifyexecutor = PureUNC.identifyexecutor,
getexecutorname = PureUNC.getexecutorname,
getexecutorversion = PureUNC.getexecutorversion,
islclosure = PureUNC.islclosure,
isluaclosure = PureUNC.isluaclosure,
isclosure = PureUNC.isclosure,
iscclosure = PureUNC.iscclosure,
newcclosure = PureUNC.newcclosure,
newclosure = PureUNC.newclosure,
clonefunction = PureUNC.clonefunction,
clonefunc = PureUNC.clonefunction,
checkcaller = PureUNC.checkcaller,
getfunctionhash = PureUNC.getfunctionhash,
isexecutorclosure = PureUNC.isexecutorclosure,
checkclosure = PureUNC.checkclosure,
isourclosure = PureUNC.isourclosure,
iskrnlclosure = PureUNC.isourclosure,
issynclosure = PureUNC.isourclosure,
cloneref = PureUNC.cloneref,
compareinstances = PureUNC.compareinstances,
gethui = PureUNC.gethui,
isrenderobj = PureUNC.isrenderobj,
cleardrawcache = PureUNC.cleardrawcache,
isrenderavailable = PureUNC.isrenderavailable,
getrenderproperty = PureUNC.getrenderproperty,
setrenderproperty = PureUNC.setrenderproperty,
getscripts = PureUNC.getscripts,
getrunningscripts = PureUNC.getrunningscripts,
getloadedmodules = PureUNC.getloadedmodules,
getinstances = PureUNC.getinstances,
getnilinstances = PureUNC.getnilinstances,
getcallbackvalue = PureUNC.getcallbackvalue,
fireproximityprompt = PureUNC.fireproximityprompt,
fireclickdetector = PureUNC.fireclickdetector,
firetouchinterest = PureUNC.firetouchinterest,
firesignal = PureUNC.firesignal,
getconnections = PureUNC.getconnections,
replicatesignal = PureUNC.replicatesignal,
isnetworkowner = PureUNC.isnetworkowner,
isscriptable = PureUNC.isscriptable,
setscriptable = PureUNC.setscriptable,
gethiddenproperty = PureUNC.gethiddenproperty,
sethiddenproperty = PureUNC.sethiddenproperty,
getthreadidentity = PureUNC.getthreadidentity,
setthreadidentity = PureUNC.setthreadidentity,
getidentity = PureUNC.getidentity,
setidentity = PureUNC.setidentity,
getthreadcontext = PureUNC.getthreadcontext,
setthreadcontext = PureUNC.setthreadcontext,
printidentity = PureUNC.printidentity,
getrenv = PureUNC.getrenv,
getsenv = PureUNC.getsenv,
getcallingscript = PureUNC.getcallingscript,
getscriptfromthread = PureUNC.getscriptfromthread,
getnamecallmethod = PureUNC.getnamecallmethod,
setnamecallmethod = PureUNC.setnamecallmethod,
getrawmetatable = PureUNC.getrawmetatable,
isreadonly = PureUNC.isreadonly,
setreadonly = PureUNC.setreadonly,
makereadonly = PureUNC.makereadonly,
makewritable = PureUNC.makewritable,
getgc = PureUNC.getgc,
getreg = PureUNC.getreg,
getregistry = PureUNC.getregistry,
getscripthash = PureUNC.getscripthash,
setrawmetatable = PureUNC.setrawmetatable,
setclipboard = PureUNC.setclipboard,
toclipboard = PureUNC.toclipboard,
setrbxclipboard = PureUNC.setrbxclipboard,
set_clipboard = PureUNC.set_clipboard,
getclipboard = PureUNC.getclipboard,
keypress = PureUNC.keypress,
keyrelease = PureUNC.keyrelease,
keyclick = PureUNC.keyclick,
keytap = PureUNC.keytap,
mouse1click = PureUNC.mouse1click,
mouse1press = PureUNC.mouse1press,
mouse1release = PureUNC.mouse1release,
mouse2click = PureUNC.mouse2click,
mouse2press = PureUNC.mouse2press,
mouse2release = PureUNC.mouse2release,
middleclick = PureUNC.middleclick,
middlepress = PureUNC.middlepress,
middlerelease = PureUNC.middlerelease,
mousemoveabs = PureUNC.mousemoveabs,
movemouse = PureUNC.movemouse,
mousemoverel = PureUNC.mousemoverel,
mouserel = PureUNC.mouserel,
mousescroll = PureUNC.mousescroll,
getmousepos = PureUNC.getmousepos,
getmouselocation = PureUNC.getmouselocation,
iswindowactive = PureUNC.iswindowactive,
isrbxactive = PureUNC.isrbxactive,
isgameactive = PureUNC.isgameactive,
writefile = PureUNC.writefile,
appendfile = PureUNC.appendfile,
readfile = PureUNC.readfile,
isfile = PureUNC.isfile,
isfolder = PureUNC.isfolder,
delfile = PureUNC.delfile,
delfolder = PureUNC.delfolder,
makefolder = PureUNC.makefolder,
listfiles = PureUNC.listfiles,
loadfile = PureUNC.loadfile,
request = PureUNC.request,
http_request = PureUNC.http_request,
httpget = PureUNC.httpget,
dofile = PureUNC.dofile,
queueonteleport = PureUNC.queueonteleport,
queue_on_teleport = PureUNC.queue_on_teleport,
clearteleportqueue = PureUNC.clearteleportqueue,
getfflag = PureUNC.getfflag,
setfflag = PureUNC.setfflag,
getfflagtype = PureUNC.getfflagtype,
getobjects = PureUNC.getobjects,
getfpscap = PureUNC.getfpscap,
setfpscap = PureUNC.setfpscap,
getsimulationradius = PureUNC.getsimulationradius,
setsimulationradius = PureUNC.setsimulationradius,
gethwid = PureUNC.gethwid,
getproperties = PureUNC.getproperties,
gethiddenproperties = PureUNC.gethiddenproperties,
getproximitypromptduration = PureUNC.getproximitypromptduration,
setproximitypromptduration = PureUNC.setproximitypromptduration,
rconsolecreate = PureUNC.rconsolecreate,
rconsoleclear = PureUNC.rconsoleclear,
rconsoledestroy = PureUNC.rconsoledestroy,
rconsoleprint = PureUNC.rconsoleprint,
rconsoleinfo = PureUNC.rconsoleinfo,
rconsolewarn = PureUNC.rconsolewarn,
rconsoleerror = PureUNC.rconsoleerror,
rconsoleinput = PureUNC.rconsoleinput,
rconsolesettitle = PureUNC.rconsolesettitle,
rconsolename = PureUNC.rconsolename,
consolecreate = PureUNC.consolecreate,
consoleclear = PureUNC.consoleclear,
consoledestroy = PureUNC.consoledestroy,
consoleprint = PureUNC.consoleprint,
consoleinfo = PureUNC.consoleinfo,
consolewarn = PureUNC.consolewarn,
consoleerror = PureUNC.consoleerror,
consoleinput = PureUNC.consoleinput,
consolesettitle = PureUNC.consolesettitle
}
if IsStudio then
Functions.hookmetamethod = PureUNC.hookmetamethod
end
PureUNC.Functions = Functions
local function ExportNested(g, force)
local n = 0
local b = EnsureTable(g, "base64")
if b then
n += ExportValue(b, "encode", PureUNC.base64encode, force)
n += ExportValue(b, "decode", PureUNC.base64decode, force)
end
local c = EnsureTable(g, "crypt")
if c then
n += ExportValue(c, "base64encode", PureUNC.base64encode, force)
n += ExportValue(c, "base64decode", PureUNC.base64decode, force)
n += ExportValue(c, "base64_encode", PureUNC.base64encode, force)
n += ExportValue(c, "base64_decode", PureUNC.base64decode, force)
n += ExportValue(c, "generatekey", PureUNC.crypt.generatekey, force)
n += ExportValue(c, "generatebytes", PureUNC.crypt.generatebytes, force)
n += ExportValue(c, "random", PureUNC.crypt.random, force)
n += ExportValue(c, "encrypt", PureUNC.crypt.encrypt, force)
n += ExportValue(c, "decrypt", PureUNC.crypt.decrypt, force)
n += ExportValue(c, "hash", PureUNC.crypt.hash, force)
n += ExportValue(c, "hmac", PureUNC.crypt.hmac, force)
local cu = EnsureTable(c, "custom")
if cu then
n += ExportValue(cu, "hash", PureUNC.crypt.hash, force)
end
local cb = EnsureTable(c, "base64")
if cb then
n += ExportValue(cb, "encode", PureUNC.base64encode, force)
n += ExportValue(cb, "decode", PureUNC.base64decode, force)
end
end
local ca = EnsureTable(g, "cache")
if ca then
n += ExportValue(ca, "invalidate", PureUNC.cache.invalidate, force)
n += ExportValue(ca, "iscached", PureUNC.cache.iscached, force)
n += ExportValue(ca, "replace", PureUNC.cache.replace, force)
end
if g.Drawing == nil or force then
ExportValue(g, "Drawing", PureUNC.Drawing, force)
end
if type(PureUNC.DrawingImmediate) == "table" and (g.DrawingImmediate == nil or force) then
ExportValue(g, "DrawingImmediate", PureUNC.DrawingImmediate, force)
end
if type(PureUNC.WebSocket) == "table" and type(PureUNC.WebSocket.connect) == "function" then
local ws = EnsureTable(g, "WebSocket")
if ws then
n += ExportValue(ws, "connect", PureUNC.WebSocket.connect, force)
end
end
local ht = EnsureTable(g, "http")
if ht then
n += ExportValue(ht, "request", PureUNC.request, force)
end
local sy = EnsureTable(g, "syn")
if sy then
n += ExportValue(sy, "request", PureUNC.request, force)
n += ExportValue(sy, "write_clipboard", PureUNC.setclipboard, force)
end
local rg = EnsureTable(g, "Regex")
if rg then
n += ExportValue(rg, "Escape", PureUNC.Regex.Escape, force)
n += ExportValue(rg, "new", PureUNC.Regex.new, force)
end
if type(PureUNC.oth) == "table" then
local ot = EnsureTable(g, "oth")
if ot then
if type(PureUNC.oth.hook) == "function" then n += ExportValue(ot, "hook", PureUNC.oth.hook, force) end
if type(PureUNC.oth.unhook) == "function" then n += ExportValue(ot, "unhook", PureUNC.oth.unhook, force) end
if type(PureUNC.oth.get_original_thread) == "function" then n += ExportValue(ot, "get_original_thread", PureUNC.oth.get_original_thread, force) end
if type(PureUNC.oth.get_root_callback) == "function" then n += ExportValue(ot, "get_root_callback", PureUNC.oth.get_root_callback, force) end
if type(PureUNC.oth.is_hook_thread) == "function" then n += ExportValue(ot, "is_hook_thread", PureUNC.oth.is_hook_thread, force) end
end
end
local gd = nil
pcall(function() gd = g.debug end)
local df = {
getinfo = PureUNC.debuggetinfo,
getconstant = PureUNC.debuggetconstant,
getconstants = PureUNC.debuggetconstants,
getproto = PureUNC.debuggetproto,
getprotos = PureUNC.debuggetprotos,
getstack = PureUNC.debuggetstack,
getupvalue = PureUNC.debuggetupvalue,
getupvalues = PureUNC.debuggetupvalues,
getcallstack = PureUNC.debuggetcallstack,
getregistry = PureUNC.debuggetregistry,
getsafeenv = PureUNC.debuggetsafeenv,
isvalidlevel = PureUNC.debugisvalidlevel,
setinfo = PureUNC.debugsetinfo,
setname = PureUNC.debugsetname,
setsafeenv = PureUNC.debugsetsafeenv,
setconstant = PureUNC.debugsetconstant,
setstack = PureUNC.debugsetstack,
setupvalue = PureUNC.debugsetupvalue
}
if type(gd) == "table" then
local cp = nil
for k, v in df do
local exists = false
pcall(function() exists = type(gd[k]) == "function" end)
if force or not exists then
local ok = pcall(function() gd[k] = v end)
if not ok then
if cp == nil then
cp = {}
pcall(function() for a, b in gd do cp[a] = b end end)
end
cp[k] = v
end
end
end
if cp then pcall(function() rawset(g, "debug", cp) end) end
elseif type(debug) == "table" then
local cp = {}
pcall(function() for a, b in debug do cp[a] = b end end)
for k, v in df do cp[k] = v end
pcall(function() rawset(g, "debug", cp) end)
end
return n
end
local function ExportAliases(g)
local function get(t, k)
if type(t) ~= "table" then
return nil
end
local ok, v = pcall(function()
return t[k]
end)
return ok and v or nil
end
local function group(a, extra)
local f = nil
for _, k in a do
local v = get(g, k)
if type(v) == "function" then
f = v
break
end
end
if not f and type(extra) == "function" then
f = extra()
end
if f then
for _, k in a do
ExportValue(g, k, f, false)
end
end
return f
end
local sy = get(g, "syn")
local ht = get(g, "http")
group({"setclipboard", "toclipboard", "setrbxclipboard", "set_clipboard"}, function()
local v = get(sy, "write_clipboard")
return type(v) == "function" and v or nil
end)
group({"request", "http_request"}, function()
local a = get(ht, "request")
if type(a) == "function" then
return a
end
local b = get(sy, "request")
return type(b) == "function" and b or nil
end)
group({"getcustomasset", "getsynasset"}, function()
local v = get(sy, "getcustomasset")
return type(v) == "function" and v or nil
end)
group({"queue_on_teleport", "queueonteleport"}, function()
local v = get(sy, "queue_on_teleport")
return type(v) == "function" and v or nil
end)
group({"hookfunction", "replaceclosure", "hookfunc", "hook_function"})
group({"restorefunction", "restoreclosure", "restorefunc"})
group({"setfpscap", "set_fps_cap"})
group({"getfpscap", "get_fps_cap"})
end
local function ShadowInstance(g)
local gi = nil
pcall(function() gi = g.Instance end)
if gi == RobloxInstance or IsStudio then
pcall(function() rawset(g, "Instance", InstanceProxy) end)
end
if IsStudio then
if gameproxy == nil then gameproxy = PureUNC.cloneref(Game) end
pcall(function() rawset(g, "game", gameproxy) end)
pcall(function() rawset(g, "Game", gameproxy) end)
end
end
local function RepairEnvironment(g)
local function set(k, v)
pcall(function() rawset(g, k, v) end)
end
local gm = nil
pcall(function() gm = g.getrawmetatable end)
if type(gm) == "function" then
local ok, v = pcall(gm, game)
if not ok or type(v) ~= "table" then
set("getrawmetatable", PureUNC.getrawmetatable)
end
end
local is = nil
pcall(function() is = g.isscriptable end)
if type(is) == "function" then
local x = RobloxInstance.new("Fire")
local ok, v = pcall(is, x, "size_xml")
x:Destroy()
if not ok or type(v) ~= "boolean" then
set("isscriptable", PureUNC.isscriptable)
end
end
end
PureUNC.Install = function(Force)
local Count = 0
local Targets = Environments()
for _, Target in Targets do
ShadowInstance(Target)
ExportAliases(Target)
for Name, Function in Functions do
if type(Function) == "function" then Count += ExportValue(Target, Name, Function, Force == true) end
end
local CloneRef = nil
pcall(function() CloneRef = Target.cloneref end)
if CloneRef == PureUNC.cloneref then pcall(function() rawset(Target, "typeof", PureUNC.typeof) end) end
Count += ExportNested(Target, Force == true)
pcall(function() rawset(Target, "pureunc", PureUNC) end)
end
for Name, Function in Functions do
if type(Function) == "function" then
if Environment[Name] == nil then pcall(function() rawset(Environment, Name, Function) end) end
if Global[Name] == nil then pcall(function() rawset(Global, Name, Function) end) end
if _G[Name] == nil then pcall(function() rawset(_G, Name, Function) end) end
end
end
pcall(function() rawset(Environment, "pureunc", PureUNC) rawset(Global, "pureunc", PureUNC) rawset(_G, "pureunc", PureUNC) end)
return Count
end
local Installed = PureUNC.Install(false)
if type(debug) == "table" and type(debug.getinfo) ~= "function" then
local Success = pcall(function() debug.getinfo = PureUNC.debuggetinfo end)
if not Success then
for _, Target in Environments() do
local Copy = {}
for Name, Value in debug do Copy[Name] = Value end
Copy.getinfo = PureUNC.debuggetinfo
pcall(function() rawset(Target, "debug", Copy) end)
end
end
end
![[KEYLESS] Moondiety Script | 17+ supported Games](https://scriptblox.com/images/sb/0-1753093706828.png)


W