Obfuscator Macros

Obfuscator Macros

Every script you upload is obfuscated with the built-in EnvyAuth VM engine before delivery. EnvyAuth reads compile-time identifiers that begin with LPH_ and acts on them during obfuscation. They don't appear in the delivered output — they're directives to the obfuscator, not runtime functions.

EnvyAuth runs the obfuscator for you automatically (Luau target, tuned for Roblox executors), so there's nothing extra to set up.

Testing locally

The LPH_ names don't exist in your raw source, so running the un-obfuscated script throws attempt to call a nil value. Define lightweight no-op shims guarded by LPH_OBFUSCATED so your script runs cleanly while you develop locally — EnvyAuth strips the dev-only branch on the real build.

A minimal stand-in for a single macro:

lua
-- - dev-only: lets the raw script run before obfuscation. - \\if not LPH_OBFUSCATED then    function LPH_NO_VIRTUALIZE(f) return f endend

LPH_NO_VIRTUALIZE

EnvyAuth uses a VM-based obfuscator: it turns your code into instructions for its own polymorphic interpreter. That's strong protection, but each operation costs extra interpreter cycles, so code that runs many times per second becomes expensive. LPH_NO_VIRTUALIZE excludes a function from virtualization and compiles it to ordinary Lua instead. The result is faster but less protected.

Takes one constant function and returns a function.

Use it for:

  • RenderStepped / Heartbeat / Stepped connections
  • __index and __namecall metamethod hooks
  • tight while loops with no wait
  • garbage-collector scan loops (getgc)
  • any function called by one of the above
lua
-- per-frame connectionRunService.RenderStepped:Connect(LPH_NO_VIRTUALIZE(function(dt)    -- runs every frame; keep it out of the VMend)) -- metamethod hooklocal oldold = hookmetamethod(game, "__index", LPH_NO_VIRTUALIZE(function(t, k)    return old(t, k)end)) -- assign first, then connectlocal generate_tracers = LPH_NO_VIRTUALIZE(function(a, b)    -- ...end)heartbeat:Connect(generate_tracers) -- immediately invoked; the trailing () actually runs itLPH_NO_VIRTUALIZE(function()    for _, v in pairs(getgc()) do        -- ...    endend)()

Wrong usage:

lua
-- Wrong: the argument is a variable, not a constant functionlocal function do_something() endLPH_NO_VIRTUALIZE(do_something) -- Wrong: not a single function expressionLPH_NO_VIRTUALIZE(    local old; old = hookmetamethod(game, "__namecall", function(...) end)) -- Wrong: defined but never invoked — the body never runs (missing the trailing call)LPH_NO_VIRTUALIZE(function()    -- ...end)

LPH_JIT and LPH_JIT_MAX

A middle ground between full virtualization and LPH_NO_VIRTUALIZE. EnvyAuth applies a faster transform path than full VM virtualization while keeping more protection than leaving the function un-virtualized. LPH_JIT_MAX optimizes more aggressively, which is faster but produces larger output.

Each takes one constant function and returns it.

lua
local step = LPH_JIT(function(x) return x * x + 1 end) local heavy = LPH_JIT_MAX(function(grid)    -- math-heavy inner loopend)

Wrong usage:

lua
-- Wrong: variable, not a constant functionlocal f = function(x) return x endlocal step = LPH_JIT(f)   -- "LPH_JIT only accepts a single constant function as an argument."

LPH_NO_UPVALUES

Compiles a function so it captures no upvalues (no access to locals from the enclosing scope). Takes one constant function and returns it.

lua
local pure = LPH_NO_UPVALUES(function(a, b)    return a + b          -- uses only its own arguments and globalsend)

Wrong usage:

lua
-- Wrong: variable, not a constant functionlocal fn = function() endLPH_NO_UPVALUES(fn) -- Wrong (logic): the body relies on an upvalue, which won't be capturedlocal secret = 42local f = LPH_NO_UPVALUES(function() return secret end)   -- `secret` is gone

LPH_ENCSTR

Encrypts a constant string at obfuscation time and decrypts it at runtime only when it's read. Keeps webhook URLs, keys, and other sensitive literals out of a plain string dump. Alias: LPH_STRENC.

lua
local webhook = LPH_ENCSTR("https://example.com/api/notify")

Wrong usage:

lua
-- Wrong: a variable is not a constant stringlocal url = "https://example.com/api/notify"local webhook = LPH_ENCSTR(url)        -- "LPH_ENCSTR only accepts a single constant string as an argument." -- Wrong: concatenation is not a single constantlocal webhook = LPH_ENCSTR("https://" .. host .. "/notify")

LPH_ENCNUM

The number counterpart to LPH_ENCSTR — encrypts a single constant double or integer. Alias: LPH_NUMENC.

lua
local place_id = LPH_ENCNUM(1818)local mask     = LPH_ENCNUM(0xDEADBEEF)

Wrong usage:

lua
-- Wrong: variable, not a constant numberlocal n = 1337local key = LPH_ENCNUM(n)              -- "LPH_ENCNUM only accepts a single constant double or integer as an argument."

LPH_ENCFUNC

Encrypts a whole function. It's decrypted lazily the first time it runs, and only if the decryption key matches. Most scripts won't need this. Alias: LPH_FUNCENC.

Takes three arguments: a constant function, a constant string encryption key, and a string variable decryption key (resolved at runtime).

lua
local dec_key = get_runtime_key()      -- a string variable, resolved at runtimelocal protected = LPH_ENCFUNC(    function()        -- only decrypted + run when dec_key matches the encryption key    end,    "my-constant-enc-key",             -- constant string    dec_key                            -- string variable)

Wrong usage:

lua
-- Wrong: the function must be a constant, and the enc key must be a constant stringlocal f = function() endLPH_ENCFUNC(f, some_key, dec_key)      -- "LPH_ENCFUNC accepts a constant function, constant string, and string variable as arguments."

LPH_OBFUSCATED

A boolean that EnvyAuth replaces with true during obfuscation. In your raw source it's nil. Use it to refuse to run when the script wasn't processed, or to gate dev-only code.

lua
-- bail out if someone runs the unprotected sourceif not LPH_OBFUSCATED then    returnend
lua
-- dev-only helpers that vanish in the real buildif not LPH_OBFUSCATED then    print("debug build")end

LPH_CRASH

Crashes and corrupts the VM context with no clean recovery. Call it from your own integrity checks when you detect tampering. Takes no arguments.

lua
if detected_hook or being_debugged then    LPH_CRASH()end

Wrong usage:

lua
-- Wrong: it takes no argumentsLPH_CRASH("tampering detected")        -- "LPH_CRASH does not accept any arguments."

See also

  • EnvyAuth Macros — the LGS_* globals the loader injects at runtime (user identity, key info, secure requests).