EnvyAuth Macros

EnvyAuth Macros

LGS_ globals tell you about the user running your script: their identity, key status, and a few helpers. Read any of them anywhere in your script. Every value has a safe default.

LGS_INIT is different and has its own section below.

Identity

  • LGS_ScriptName (string) — the script's name.
  • LGS_ScriptVersion (string) — the script's version, e.g. "1.4.2.0".
  • LGS_DiscordID (string) — the Discord ID linked to the user's key, or "" if it isn't linked.
  • LGS_DiscordUsername (string) — the user's Discord username.

Key and status

  • LGS_PREMIUM (boolean) — true if the user is whitelisted.
  • LGS_Keynote (string) — the note on the user's key.
  • LGS_TimeLeft (number) — seconds until the key expires. math.huge if it never expires.
  • LGS_CurrentHWID (string) — the HWID bound to this session.
  • LGS_SessionID (string) — the session ID.

Counters

  • LGS_Executions (number) — total times the user has run your scripts.
  • LGS_ScriptExecutions (number) — times this script has run.
  • LGS_TotalSessions (number) — sessions the user has opened.

LGS_INIT

Run your own code before the loader starts, before the key check and everything else. Use it for setup that has to come first, like an anti-cheat bypass that needs to be in place before the loader touches the game.

lua
LGS_INIT(function()    -- block the game's detection remote before the loader makes any calls    local detection = game:GetService("ReplicatedStorage"):WaitForChild("Detection")     local old_namecall    old_namecall = hookmetamethod(game, "__namecall", newcclosure(function(self, ...)        if self == detection and getnamecallmethod() == "FireServer" then            return        end        return old_namecall(self, ...)    end))end)

Rules:

  • One per script, at the top level (not inside an if, function, or loop).
  • The block is not obfuscated, so don't put secrets in it.
  • It runs in its own scope and can't read variables from the rest of your script. Pass things out through a global like getgenv().
  • It blocks the loader, so if you wait on something, loop with task.wait().

Limitations:

  • The other LGS_ macros aren't ready yet, so LGS_PREMIUM, LGS_DiscordID, LGS_SecureRequest, and the rest are nil inside the block.
  • Runs on the first execution only, not after a rejoin from LGS_ExecOnRejoin.
  • Max 8 KB. Keep it to setup and leave the heavy logic in your main script.
  • No safety timeout. A block that never returns hangs the loader, so don't leave a loop without a task.wait.

LGS_BLACKLIST

lua
LGS_BLACKLIST(reason)

Blocks the current user and kicks them. It never returns, so nothing after the call runs. Use it to revoke access when someone breaks a rule you set.

  • reason (string, optional) — a short label saved with the block. Anything that isn't a string becomes "Blacklisted by script".
lua
if shared_key_detected then    LGS_BLACKLIST("key sharing")end

Limitations:

  • It's a hard stop. The player is kicked, the user is flagged on the server, and the script ends. There's no undo and no return value.
  • A false positive locks out a real customer, so only call it on a condition you trust.

LGS_SecureRequest

lua
local response = LGS_SecureRequest(data)

Sends an HTTP request through the EnvyAuth proxy instead of your executor's request(). The call to the proxy is encrypted, so a hooked request or a network capture has a harder time reading the URL, headers, and body.

data is a table:

  • Url (string) — the target URL. Required.
  • Method (string) — "GET", "POST", and so on.
  • Headers (table, optional) — { [name] = value }.
  • Body (string, optional) — the request body.

It always returns a table, even on failure:

  • Success (boolean) — true only on a 2xx response.
  • StatusCode (number) — the HTTP status, or 0 if it never completed.
  • Body (string) — the response body, or a short error string on failure.
  • Headers (table) — the response headers, or {}.
lua
local HttpService = game:GetService("HttpService") local response = LGS_SecureRequest({    Url    = "https://your-api.example/verify",    Method = "POST",    Body   = HttpService:JSONEncode({ discord_id = LGS_DiscordID }),}) if response.Success then    local data = HttpService:JSONDecode(response.Body)    -- use dataend

Limitations:

  • It hides the call, it doesn't secure the endpoint. Anyone who controls or watches your URL still sees the traffic there. Treat it as one layer, not a guarantee.
  • It never returns nil and never throws. On failure you still get a table, so branch on response.Success, not response == nil.
  • No Url means there's nothing to fetch, and a non-table data becomes an empty request that fails.

LGS_ExecOnRejoin

lua
local armed = LGS_ExecOnRejoin()

Arms your script to run again after the next teleport. Call it before you send the player somewhere; when they land, the loader re-runs and your script starts over on the same session. Returns true if it's armed, false if it couldn't be (usually no queue_on_teleport, or the server didn't return a token).

lua
-- arm first, then teleportif LGS_ExecOnRejoin() then    game:GetService("TeleportService"):Teleport(game.PlaceId)end

Limitations:

  • One-shot. One call covers one teleport, so call it again after each rejoin.
  • The re-run isn't a new execution, so counters like LGS_ScriptExecutions don't move.
  • If the token expires (the teleport took too long) or the session already ended, the loader falls back to a normal fresh start.
  • Returns a boolean, not session data.

See also

  • Obfuscator Macros — compile-time LPH_ directives supported when EnvyAuth obfuscates your script.