Key check library

Status codes

Every code check_key can return, what it means, and what to tell the player.

On this page

Key check codes

check_key(key) always returns a table with code, a human-readable message and optional data:

lua
local status = lib.check_key(key)
print(status.code, status.message)
CodeMeaningWhat to show
KEY_VALIDThe key is valid for this script.Continue — call load_script().
KEY_INCORRECTThe key does not exist."Invalid key — get a new one." Open get_key_url().
KEY_EXPIREDThe key's time is up."Your key expired — get a new one."
KEY_BANNEDThe key is disabled, its Discord account / device is banned, or a one-time key was already used. message says which."This key can't be used." Show status.message.
KEY_HWID_LOCKEDThe key is bound to another device."Reset your HWID" — point to your Discord bot panel.
SCRIPT_ID_INCORRECTThe script doesn't belong to this key's service.Check lib.script_id.
KEY_PREMIUM_REQUIREDA standard key on a Premium Service (service setting) or on a script with Premium keys only (Obfuscation)."This script requires a premium key." Show status.message.
SCRIPT_DISABLEDYou turned on the script's kill-switch (Obfuscation).Show status.message — your disable message, "This script is temporarily disabled by its developer." by default.
KEY_INVALIDClient-side: empty key or shorter than 4 characters."Enter your key."
NETWORK_ERRORClient-side: the API couldn't be reached."Couldn't reach the server, try again."
UNKNOWNClient-side: the server answered without a code.Show status.message and let the player retry.

Handling them

lua
local messages = {
    KEY_INCORRECT = "Invalid key. Press 'Get key' to get a new one.",
    KEY_EXPIRED = "Your key has expired.",
    KEY_HWID_LOCKED = "Key is locked to another device. Reset your HWID.",
    NETWORK_ERROR = "Couldn't reach the server. Try again.",
}

local status = lib.check_key(key)
if status.code == "KEY_VALID" then
    lib.load_script()
else
    label.Text = messages[status.code] or status.message
end

Kicks from the built-in whitelist

Without the library, the embedded whitelist kicks instead of returning a code:

Kick messageCause
No key foundNo script_key was set.
Server message, e.g. The provided key does not existThe key failed validation.
Security / integrity kickHooking or tampering was detected, or the session couldn't be verified.