/roblox-dev:roblox-securityfrom roblox-dev
Server-authoritative security patterns for Roblox games — validates RemoteEvents/RemoteFunctions, prevents exploits, rate limits, and enforces never-trust-the-client. Use when writing or reviewing code touching remotes, player input, currency, damage, inventory, or purchases.
Ships in roblox-dev. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Every Roblox client is fully controllable by its user. Exploiters can read all client code, fire any RemoteEvent with arbitrary arguments, modify their own character physics, and inspect everything replicated to them. Security exists only on the server.
nil, NaN, math.huge, negative numbers, wrong types,
tables shaped to crash your handler, and Instances that don't exist.ReplicatedStorage, StarterPlayerScripts, StarterGui; all remote names;
all attribute values. Never ship secrets, admin lists with privileges
decided client-side, or "hidden" prices.Validate type → range → permission → plausibility, in that order, and return early on any failure. Do not error loudly to the exploiter; just drop the request (optionally log it).
--!strict
local function onBuyItem(player: Player, itemId: unknown, quantity: unknown)
-- 1. TYPE: never assume types match your signature
if typeof(itemId) ~= "string" then return end
if typeof(quantity) ~= "number" then return end
-- 2. RANGE: reject NaN, infinity, negatives, non-integers, absurd sizes
if quantity ~= quantity then return end -- NaN check: NaN ~= NaN
if quantity ~= math.floor(quantity) then return end
if quantity < 1 or quantity > 100 then return end
-- 3. PERMISSION: does this item exist, can THIS player buy it?
local item = ItemCatalog[itemId]
if not item then return end
local profile = PlayerData.get(player)
if not profile then return end
-- 4. PLAUSIBILITY: server-side price, server-side balance check
local cost = item.price * quantity -- price from SERVER catalog
if profile.coins < cost then return end
-- All checks passed: mutate on server, then replicate the result
profile.coins -= cost
Inventory.grant(player, itemId, quantity)
end
Key traps:
NaN passes typeof(x) == "number" and most comparisons. Check x ~= x.math.huge and -math.huge pass number checks. Clamp or bound everything.nil, and non-string keys are converted to strings. If you accept a table,
validate every field you read; better, avoid table arguments and send
scalars.Instance argument can be any instance the client can see. One the client
created locally arrives as nil. Verify it is the kind of instance you
expect AND that the player may act on it.itemId.Name on a
non-Instance throws and kills your handler thread.For larger games, centralize this in a guard module (or use a runtime type library) so every remote handler starts with a declarative check.
For world interactions (opening a chest, picking an item, attacking):
local MAX_REACH = 20 -- studs; tune per interaction
local function canReach(player: Player, target: BasePart): boolean
local character = player.Character
local root = character and character:FindFirstChild("HumanoidRootPart")
if not root or not root:IsA("BasePart") then return false end
return (root.Position - target.Position).Magnitude <= MAX_REACH
end
Also verify state: the chest is not already open, the mob is alive, the item has not been claimed by someone else this frame (re-check inside the handler, not just in the UI that fired it).
Exploiters fire remotes thousands of times per second. Per-player, per-remote budgets stop both damage and server load:
--!strict
local buckets: { [Player]: { [string]: { tokens: number, last: number } } } = {}
local function allow(player: Player, key: string, ratePerSec: number, burst: number): boolean
local now = os.clock()
local playerBuckets = buckets[player]
if not playerBuckets then
playerBuckets = {}
buckets[player] = playerBuckets
end
local b = playerBuckets[key]
if not b then
b = { tokens = burst, last = now }
playerBuckets[key] = b
end
b.tokens = math.min(burst, b.tokens + (now - b.last) * ratePerSec)
b.last = now
if b.tokens < 1 then return false end
b.tokens -= 1
return true
end
Players.PlayerRemoving:Connect(function(player) buckets[player] = nil end)
Use it as the first line of every remote handler:
if not allow(player, "BuyItem", 3, 5) then return end.
Track repeat offenders; a player tripping rate limits hundreds of times is telemetry worth logging, but do not auto-ban on it alone (mobile lag and retry loops cause false positives).
RemoteFunction:InvokeClient from the server for anything you
need. A client that never returns yields the server thread forever; one
that errors or disconnects makes the call throw on the server; any client
can return garbage. If you must notify the client and get an answer, use two
RemoteEvents with a server-side timeout.OnServerInvoke needs the same validation as events, plus: its
return value is an information channel. Don't return internal state the
client shouldn't see.When reviewing a codebase, look for these specific patterns:
| Pattern | Risk |
|---|---|
remote.OnServerEvent:Connect(function(player, dmg) humanoid:TakeDamage(dmg) | Client chooses damage. Server must compute damage from server-known weapon stats. |
| Client tells server "I killed X, give reward" | Server must witness the kill (server-side hit detection or server-validated projectile). |
| Tool/weapon stats read from the Tool instance the client sends | Exploiter sends a modified tool. Look stats up server-side by item id. |
| Price/cost read from a GUI or client argument | Server catalog only. |
player.leaderstats.Coins.Value mutated from a LocalScript | Only replicates locally — but if a server script later reads it back, it's an exploit path. Server state lives in server modules, not in replicated Value objects. |
| Teleport/CFrame requests without bounds | Validate destination is a legal teleport target for that player. |
Remote named GiveAdmin, SetCoins, dev/test remotes left in production | Gate every privileged remote by a server-side allowlist of UserIds, and strip QA remotes outside Studio (RunService:IsStudio()). |
By default the client simulates and replicates its own character movement, so speed/fly/teleport hacks cannot be prevented, only detected and bounded server-side.
Roblox's Server Authority mode (Workspace.AuthorityMode = Enum.AuthorityMode.Server, out of beta since 2026) makes the server
authoritative for movement and physics with client prediction. It requires
rewriting movement logic around RunService:BindToSimulation, InputActions,
deferred signals and streaming, so suggest it for new competitive games, not
as a drop-in fix. It does not validate remote arguments: everything above
still applies.
Without Server Authority:
HumanoidRootPart.Position on the server; flag
displacement that exceeds max legitimate speed × elapsed time (with margin
for teleports you initiated and physics flings).When you (Claude) generate any new gameplay system, produce this shape without being asked:
Shared/Types.luau — shared type definitions for payloads.If the user asks for something inherently insecure ("let the client set its coins"), implement the secure version and explain the change in one sentence.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub ivar-anon/roblox-dev --plugin roblox-dev10 skills in this plugin
/luau-strict-typingLuau strict mode typing patterns — annotations, narrowing Instance? results, forward declarations, typed remotes, generics, and fixing common --!strict type errors. Use when writing Luau code, enabling --!strict, or resolving Luau type-checker warnings in Roblox projects./new-systemGenerate a complete, secure client/server gameplay system for Roblox — shared types, validated server module, client controller, and remote registration in one pass. Use when adding a feature like a shop, inventory, combat ability, quest, or any system that spans client and server./reviewRun a structured security, data-safety, performance and typing review of Roblox/Luau code using the roblox-reviewer agent. Use when asked to review Roblox code, audit a game for exploits or leaks, or before shipping a system.Other plugins' skills for the same job