What this is: Inside a protected script, a global LuaProtect table gives you what the server knows about the player running it: who they are, their key, their Discord link, and numbers about your script. Read a field like any other value: LuaProtect.Key.Note, LuaProtect.User.Username, LuaProtect.Script.Executions.
The namespaces
Namespace
What it holds
LuaProtect.User
The Roblox player: username, user id, executor, how often they ran this script.
LuaProtect.Key
The license key locked to this device: note, expiry, time left, HWID lock, uses.
LuaProtect.Discord
The Discord account linked to the player, and your server invite.
LuaProtect.Script
The script itself: name, version and execution totals.
LuaProtect.Session
This run: session id, when it started and how it is connected.
LuaProtect.Storage
Live data and per-player saves. See Data storage.
LuaProtect.Feedback
Star ratings from inside the game. See Player reviews.
LuaProtect.Theme
The values the owner set in the Style tab, so a window you draw can match the key prompt and review card.
LuaProtect.User
Field
Type
Value
Username
string
The Roblox username.
UserId
number
The Roblox user id.
Executions
number
How many times this player has run this script.
Executor
string
The executor the runner detected.
Fingerprint
string
A short, one-way code of the device. The real HWID is never sent to the script.
LuaProtect.Key
The key is found from the verified device, so a script cannot ask for another player's key. Scripts that run without a key (open scripts) get Valid = false and empty fields.
Field
Type
Value
Valid
boolean
true when an active key is locked to this device.
Code
string
The full key. Use Masked to show it on screen.
Masked
string
The key with the middle hidden, like ABC...123.
Prefix
string
The key prefix, if you use one.
Note
string
The note you wrote on the key in the dashboard, for example "vip" or "giveaway".
Type
string
How the key was made, for example redeem or a key flow.
Lifetime
boolean
true when the key never expires.
ExpiresAt
number
Unix time the key ends. 0 for lifetime keys.
TimeLeft
number
Seconds until the key ends, counted live. 0 for lifetime keys, so check Lifetime first.
CreatedAt / FirstUsedAt
number
Unix times.
HwidLocked
boolean
true when the key is bound to a device.
Uses / MaxUses
number
How often the key was used and how often it may be.
LuaProtect.Discord
Field
Type
Value
Linked
boolean
true when the player linked their Discord account (/link in your server or the in-game code).
Id
string
The Discord user id, or "" when not linked.
Username
string
The Discord username, or "" when not linked. It is looked up in the background, so the very first read can be empty: call LuaProtect:Refresh() a moment later.
DisplayName
string
The Discord display name (global name), falling back to the username.
Invite
string
Your server invite from the script settings, or "".
LuaProtect.Script
Field
Type
Value
Id
string
The script id.
Name
string
The script name.
Version
number
The release version this run came from, or 0 when you do not use releases.
Executions
number
Total executions of the script. Cached for about a minute.
UniqueUsers
number
Distinct players in the recent window.
Last24h
number
Executions in the last 24 hours.
LuaProtect.Session
Field
Type
Value
Id
string
The session id, the same one the dashboard shows for this player.
StartedAt
number
Unix time this connection started.
Transport
string
"ws" for a WebSocket, "https" for the long-poll fallback.
LuaProtect.Theme
The look the script owner picked in the Style tab. Use it to draw your own windows in the same colours as the key prompt, announcements and review card. Fields the owner left on the default are nil, except the status colours, radius and angle, which always carry the value in use.
Field
Type
Value
Background
Color3
Card background.
Background2
Color3
Second background colour when a gradient is set, otherwise nil.
Text
Color3
Main text colour.
Accent
Color3
The accent, only when the owner set one (nil keeps your own colour).
Accent2
Color3
Second accent colour for a gradient, otherwise nil.
Success / Warning / Danger
Color3
Status colours.
Angle
number
Gradient angle in degrees.
Radius
number
Corner roundness the owner chose (0 to 24).
Icon
string
Name of the brand icon, or nil.
local Theme = LuaProtect.Theme
local card = Instance.new("Frame")
card.BackgroundColor3 = Theme.Background
card.Size = UDim2.fromOffset(320, 160)
Instance.new("UICorner", card).CornerRadius = UDim.new(0, Theme.Radius)
if Theme.Background2 then
local g = Instance.new("UIGradient", card)
g.Color = ColorSequence.new(Theme.Background, Theme.Background2)
g.Rotation = Theme.Angle
card.BackgroundColor3 = Color3.new(1, 1, 1)
end
local accent = Theme.Accent or Color3.fromRGB(59, 130, 246)
A full example: The LuaProtect showcase script on ScriptBlox draws its whole window from LuaProtect.Theme plus the User, Key, Discord, Script, Storage and Feedback namespaces. It is a good starting point to copy from.
Example
local LP = LuaProtect
print(("Welcome %s! Run #%d of %s"):format(LP.User.Username, LP.User.Executions, LP.Script.Name))
if LP.Key.Valid then
if LP.Key.Lifetime then
print("Your key is lifetime. Note: " .. LP.Key.Note)
else
print(("Your key ends in %d hours"):format(math.floor(LP.Key.TimeLeft / 3600)))
end
end
if not LP.Discord.Linked and LP.Discord.Invite ~= "" then
print("Link your Discord for buyer roles: " .. LP.Discord.Invite)
end
Everything at once, and refreshing
-- One table with user, key, discord, script and session
local info = LuaProtect:Info()
print(info.key.Note, info.script.Executions)
-- Ask the server again (for example after the player redeemed a key).
-- Normal reads reuse the data for 30 seconds.
LuaProtect:Refresh()
local fresh = LuaProtect:Info(true)
How it behaves
The first read of a field asks the server once (it yields for a moment, usually well under a second); every later read is instant. The data is reused for 30 seconds, and a player can make at most about 2 fresh requests per second.
Fields never come back as nil. If the server cannot be reached, you get "", 0 or false, so you can join them into a string without a nil check. Check LuaProtect.Key.Valid before you rely on the key fields.
Do not enforce rules with these values: The script runs on the player's computer, and a player can change what a script sees. Use these values to greet players, show a countdown or unlock cosmetics. For anything that gives a reward or protects your data, check on your own server with the REST API.
What is never sent: Other players' data, IP addresses, the raw HWID, and anything from your account. Each player only gets their own session, on their own encrypted connection.