Lesson 9 of 11
Security at scale: one validation layer, shared bans, device trust
Move Beacon Yard from one-server anti-cheat to checks that hold across servers: one remote wrapper with token buckets, cross-server ExploitWatch strike sync, rule kill switches, Device Trust gating and Script Capabilities.
By the end you can
- Use one server-side validation layer for incoming requests, then see where the live milestone adds rule kill switches
- Persist recent strikes across servers with StrikeService, UpdateAsync and MessagingService
- Gate sensitive features on the server with the Device Trust API while handling Unknown, Pending and Studio playtests safely
- Separate real server-side containment (Script Capabilities and validation) from client-side obfuscation myths
Before this: Exploiters in production: detect, log, ban, appeal, Remotes: events, functions, unreliable, buffers, Security: never trust the client, MemoryStore and MessagingService: matchmaking across servers
Step 1 of 10
Why per-service checks fail at scale
Open src/server/Remotes.luau at m14-ship. It creates six RemoteEvent instances in one folder, then hands them straight back to whichever service calls Remotes.get. Each service wires its own OnServerEvent listener and invents its own checks.
local REMOTE_NAMES: { string } = { "RoundState", "Feedback", "ShopOpen", "ShopBuy", "Swing", "SetSetting" }
type RemoteArg = string | number | boolean | Vector3 | nil
local Remotes = {}
local cache: { [string]: RemoteEvent } = {}
Now compare how the three client-to-server remotes guard themselves today. CombatService keeps a lastSwing map with SWING_GAP = 0.4. SettingsService keeps a lastChange map with MIN_GAP_SECONDS = 0.1. ShopService connects straight to ShopBuy with no rate limit at all.
Remotes.get("ShopBuy").OnServerEvent:Connect(function(player: Player, item: unknown)
ShopService.purchase(player, item)
end)
With six remotes, missing one check is easy. With sixty remotes in a large game, scattered checks make a missed rate limit or an unchecked table argument on update day likely.
| In the picture | In Roblox |
|---|---|
| The turnstile | One Remotes wrapper every client-to-server handler registers through |
| The clicker counter | Per-player token buckets that absorb short bursts and stop floods |
| The ticket scanner | Schema validation, permission checks and rule kill switches before gameplay logic runs |
Think of a stadium with one turnstile. Every guest goes through the same gate, where a clicker counts how fast people come through and a scanner checks each ticket the same way, whoever the guest is. Nobody has to remember which side door has a guard, because there are no side doors. In the game, the turnstile is one remote wrapper, the clicker is a per-player token bucket, and the scanner is the schema and permission checks.
Think of it as A single stadium turnstile with one ticket scanner and one clicker counter
At m14-ship, Beacon Yard has three client-to-server remotes: Swing, SetSetting and ShopBuy. Which one has no per-player rate limit in its server listener?
Press 1 to 4 to choose, Enter to check.
Step 2 of 10
One validation layer in Remotes.luau
At m15-scale, services register handlers with RemoteGuard.connect(name, handler). RemoteGuard.RULES supplies the rate, schema and optional permission check. RemoteGuard.SERVER_ONLY marks RoundState, State, Feedback and ShopOpen as directional honeypotsHoneypotA remote that looks real but that no legitimate client script ever fires.Think of it as a door in the yard fence that leads nowhere, watched by a camera.1.
The guard takes a token first, validates arguments with ArgSchema.check, then calls the optional permission check. A swing requires a living character. A shop purchase requires a loaded profile. At m17-live-season, RemoteGuard also checks a rule's optional feature switch, after the schema check and before the permission check.
Server sideRemember: A shared remote validation wrapper is a single stadium turnstile with one ticket scanner and one clicker counter.
The clicker comes before the scanner for a reason. Counting a guest costs nothing; reading a ticket takes time. So a crowd rushing the gate is stopped at the clicker before anyone spends time scanning.
Why does RemoteGuard.check take a token from the bucket before it runs the schema check?
Press 1 to 4 to choose, Enter to check.
Step 3 of 10
Token buckets beat fixed cooldowns
Roblox caps client-to-server remote calls at roughly 500 requests per second per client shared across all remotes of the same type; excess RemoteEvent calls are delayed in order2. Your game's limit should sit far lower, tuned to each action.
A fixed gap like SettingsService's 0.1 seconds feels fine for toggles, yet breaks natural bursts. In Beacon Yard's shop, a player with 65 coins might click Speed and Shield 0.2 seconds apart. A 0.5-second fixed cooldown denies the second legitimate click. A token bucketToken bucketA rate limiter that lets short bursts through up to a cap while holding sustained traffic to a steady refill rate.Think of it as a ticket dispenser that refills two tickets a second and holds at most five. gives each player a small burst capacity (say 3 clicks) that refills steadily at refillRate (say 1 token per second). Short human bursts pass; sustained macros hit the wall.
Notice the math.min(bucket.capacity, ...) clamp. Without it, a player who sits idle for ten minutes would stockpile 600 tokens and fire a 600-call burst that stalls the server. Always clean up each player's bucket table on Players.PlayerRemoving so disconnected players never leak memory.
Starting right after the Run cell above (tokens = 0.0 at t = 11.0, capacity = 3, refillRate = 1), what does consume(shopBucket, 50.0, 1) return, and how many tokens remain?
local ok = consume(shopBucket, 50.0, 1)
print(ok, shopBucket.tokens)
Press 1 to 4 to choose, Enter to check.
Step 4 of 10
Persisted strikes, cross-server sync and audit logs
In Exploiters in production: detect, log, ban, appeal, the ExploitWatch challenge scores in-memory records. At m15-scale, ExploitWatch supplies the weights, 600-second window and verdicts. StrikeService gives those strikes a life beyond one server.
At scale, two mechanisms stop a player from escaping their strikes by joining another server:
- Persisted strike window in a DataStore.
StrikeServicesaves active strikes underu_<userId>inBeaconYard_StrikeswithUpdateAsync, merging the server's new strikes with whatever another server wrote and dropping strikes older thanWINDOW_SECONDS(600 s). Never useSetAsync, or two servers finishing a round will overwrite each other's evidence3. - Cross-server sync via MessagingService.
StrikeServicepublishes each new strike onExploitStrikes.StrikeLedger.encodeMessagesends{ u, i, k, t, s }for user id, strike id, kind, time and origin server. The strike id is a GUID fromHttpService:GenerateGUID, so the same strike seen twice is easy to spot. A receiving server merges a valid strike for a player already there4.
At m15-scale, EconomyAudit records coin grants of at least 50. Each in-memory entry holds { at, userId, amount, balance, sku }. The module keeps the most recent 200 entries and uses the analytics callback for the corresponding custom event.
A player teleports on Server A (strike s2, weight 3), leaves, and triggers a speed strike on Server B (strike s4, weight 1) ten seconds later. Why should the strike service merge each save with UpdateAsync?
Press 1 to 4 to choose, Enter to check.
Step 5 of 10
Rule kill switches and where the turnstile breaks
A live kill switch can pause a faulty rule while you investigate it. At m15-scale, strike verdicts use the Config.STRIKES_ENFORCE setting. The later remote feature switches use FlagService.
The same applies to remotes: the shop feature switch (shop_enabled = false) at m17-live-season lets you freeze a buggy purchase path during an incident while players keep playing drills.
Where does it break?“A single stadium turnstile with one ticket scanner and one clicker counter” is a good picture of a shared remote validation wrapper. Where does it stop being true?
It breaks here. A guest with a real ticket still exploits a rule bug inside the stadium, or a faulty scanner locks out honest visitors across every gate.
The true model. A single wrapper guarantees every remote enforces rate limits, shapes, permissions and logging consistently, but it still depends on sound game rules inside handlers and a kill switch to disable a misfiring check.
The single validation gate guarantees that no remote skips rate limits or shape checks, yet it cannot save a broken game rule inside the handler. If ShopService forgot to check profile.speedOwned before charging coins, a completely valid ShopBuy("Speed") request passes every gate and still drains the player's balance. Worse, if a single buggy check inside the shared wrapper throws or rejects valid arguments, it locks out honest players across every remote that shares it.
Beacon Yard routes ShopBuy through RemoteGuard with a token bucket and schema check. Which bug can STILL happen inside ShopService even when the wrapper works perfectly?
Press 1 to 4 to choose, Enter to check.
Step 6 of 10
Device Trust: gating sensitive features safely
Roblox's Device TrustDevice TrustA Roblox signal reporting how strongly the platform can verify that a player's device and Roblox app have not been tampered with.Think of it as an airport security badge on the device, not a judgment on the person holding it. API tells the server how strongly Roblox can verify that a player's device is physical, untampered and running an unmodified Roblox app5. Roblox takes no action on it automatically; your server decides what to do via Player.DeviceTrustLevel and the IntegrityService.EvaluatePlayerDeviceTrust callback.
Enum.PlayerDeviceTrustLevel | Meaning |
|---|---|
Pending | Check is still running on join; every player starts here |
Unknown | Unsupported platform (or Roblox-side error); cannot tell whether trusted |
None | Failed check, or unverifiable platform (such as Web browser) |
Standard | Passed some checks; mostly secure |
Full | Passed every check |
Check platform coverage before writing a strict rule: as documented today, Android, Chromebook and Meta Quest report None, Standard or Full; Web browser reports None; iOS, macOS and Windows are marked coming soon and report Unknown5. That is why Roblox warns bluntly that Unknown does not mean untrusted.

Select a numbered pin, or a row below, to read what it marks.
Before gating any feature, inspect Safety > Anti-cheat in Creator Hub to see what share of your real audience sits in each bucket5. Then apply the lightest policy that fits: let everyone play the core yard, gate high-risk features like trading to { Unknown, Standard, Full } (or { Standard, Full } for competitive ranked queues), and only reject None on join as a last resort.
Two traps catch teams in production:
- Never enforce trust on the client. Read
player.DeviceTrustLevelon the server, send the allowed feature flags down for UI, and re-check on the server before executing the trade or queue join. - Never trust
measuresalone. A measure inEvaluatePlayerDeviceTrustreportstruewhen unavailable on that device, so checkDeviceTrustLevelfirst. And in Studio playtests, Roblox never checks devices:DeviceTrustLevelstaysPendingand the callback never runs, so keep your policy in a pure function and allowRunService:IsStudio()during local playtests while unit-testing every enum value5.
You gate a new Beacon Yard trading booth to only Standard and Full devices, blocking Unknown. What happens to honest players on Windows, macOS and iOS today?
Press 1 to 4 to choose, Enter to check.
Step 7 of 10
Obfuscation myths and Script Capabilities
New teams often buy a Luau obfuscator hoping to hide remotes or combat math inside LocalScripts. That does not protect game logic. Anything sent to the client lives in the client's memory, and an exploiter can still inspect every RemoteEvent:FireServer call and replay it with forged arguments. Obfuscation only makes your own crash stack traces unreadable and slows down debugging. Keep secrets and authority on the server.
Where Roblox does offer real isolation is Script CapabilitiesScript CapabilitiesContainer-level sandbox permissions that restrict what scripts inside a model or folder can access.Think of it as keycard doors that keep a guest contractor out of the vault.6. They are experimental and available as a client beta: turn them on by setting Workspace.SandboxedInstanceMode to Experimental. On a container such as a Model or Folder, enabling Sandboxed and picking explicit Capabilities restricts every script inside it:
- Leave
AccessOutsideWriteoff so sandboxed scripts cannot reachscript.Parent.Parentor read instances outside their container (evenTouchedevents passnilfor outside parts). - Leave
DataStore,ConsequencesandLoadUnownedAssetoff so a third-party prop or user-created plugin script inside a sandboxed model can never touch player profiles, ban players or require external assets. - Leave
RunServerScriptoff on decorative models so a hidden serverScriptinside an imported prop refuses to start with a clear warning in Output.
Choosing your remote validation and security layers
| Option | What it is | When pros pick it | Trade-offs |
|---|---|---|---|
| Central wrapper + hand-written guards | One Remotes wrapper with token buckets, kill switches and plain Luau type checks. | Most games up to medium scale, including Beacon Yard, where remotes are few and strict Luau types already exist. | Zero external dependencies; you write each remote's argument validator yourself. |
| Central wrapper + t (osyrisrblx/t) | Composable runtime type validators (t.interface, t.numberConstrained) inside the wrapper. MIT licence, stable (last push 2025-03-11), Wally osyrisrblx/t@3.1.1. | Large games with dozens of complex nested remote payloads. | Small runtime cost per call; adds a shared dependency. |
| Schema-generated net layer (Blink / Zap) | Generates binary serializers and server validators from one IDL file. Blink (MIT, active 2026-11) and Zap (MIT, active 2026-06). | High-bandwidth games that also want compact buffers and generated type checks together. | Adds a code-generation step to your build workflow. |
| Client obfuscation | Rewrites LocalScript bytecode or variable names to look unreadable. | Rarely worth it; at most mild friction against casual script readers. | Never prevents remote spoofing or memory inspection; breaks your own Error Report stack traces. |
Which two practices genuinely reduce security risk in a large Roblox codebase?
Press 1 to 4 to choose, Enter to check.
Step 8 of 10
Build along: harden Beacon Yard's server boundary
Use the level 3 challenge to practise the policy in isolation. Then compare it with the game modules that first appear at m15-scale.
src/server/Remotes.luausrc/server/RemoteGuard.luausrc/shared/TokenBucket.luausrc/shared/ArgSchema.luausrc/server/ExploitWatch.luausrc/server/StrikeService.luausrc/server/StrikeLedger.luausrc/shared/DeviceTrust.luausrc/server/DeviceTrustService.luausrc/server/EconomyAudit.luau
Define
RemoteGuard.RULESforSwing,ShopBuy,SetSettingandStateSync. Connect the handlers throughRemoteGuard.connect. Register the directional checks for server-only remotes and the separateGrantCoinshoneypot. Add bucket and logging cleanup toPlayerScopes.You should see A guarded request reaches its service only after rate, shape and permission checks.
Use
ExploitWatchfor scoring andStrikeLedgerfor merge and message shapes. Save withUpdateAsyncand publish onExploitStrikes. InspectStrikeService.saveandStrikeService.receivefor the persistence and cross-server paths.EconomyAuditrecords high-value coin events throughAnalytics.You should see StrikeService shares new strikes and saves a merged record. Verdicts only act when enforcement is enabled.
Put the policy in
DeviceTrust.allowFeature. The leaderboard permits Standard and Full; trading permits Unknown, Standard and Full, as the docs suggest for trade hangouts.DeviceTrustService.allowsapplies the policy on a published server and permits the feature in Studio. When an Unknown device sets a best score, the server prints[Leaderboard] score from <id> not recorded: device trustand the player keeps playing as normal.You should see Device Trust policy is testable for every level. Studio permits the playtest.
The rule-level kill switch arrives in the live milestone.
Build along
src/server/RemoteGuard.luau
In
RemoteGuard.RULES, add the optionalfeaturefield where the rule needs a live kill switch. Atm17-live-season,ShopBuyuses"shop".RemoteGuard.checktakes the token and checks the arguments first, then consultsFlagService.enabled. When the feature is paused it firesFeedbackwith the deny sound and the pause text fromLiveFlags.pausedMessage, prints[Guard] ShopBuy from <id> rejected: shop is switched offat most once every 10 seconds per player, and returns"off".You should see With shop_enabled off, a purchase shows the toast Shop is paused for maintenance and plays the deny sound. The server prints that the shop is switched off and gives no strike.
Step 9 of 10
Challenges
Level 2, Builder
Challenge
Write a one-page Remote Security Contract (docs/remote-security-contract.md in your copy of Beacon Yard) covering all six remotes in src/server/Remotes.luau. This is a design self-check; no automated test grades it.
- Start from
- The game at milestone m14 (download)
Done means
- A table listing all 6 Beacon Yard remotes (RoundState, Feedback, ShopOpen, ShopBuy, Swing, SetSetting) with their allowed direction
- Exact argument schema, token-bucket capacity and refill rate for every client-to-server remote
- Directional honeypot action for every server-to-client remote if fired by a client
- Kill-switch Experience Config key name for each remote and detection rule
Meet the criteria above, then record your own result. No test grades this check.
Level 3, Professional
Challenge
Complete challenges/work/security_guard.luau so the shared remote wrapper, cross-server strike merger and Device Trust policy pass every check. Run game.ServerScriptService.RunGameTests:Invoke("security-at-scale", "security-at-scale-guard") in Studio (or test in the pure Luau runner). Written solution: challenges/solutions/security-at-scale.md.
- Start from
- The game at milestone m14 (download)
- Grade it
- In Studio, press Play, then run
game.ServerScriptService.RunGameTests:Invoke("security-at-scale", "security-at-scale-guard")in the server command bar. Copy the pass code from Output.
Done means
- consume refills tokens by elapsed time * refillRate clamped to capacity, and never leaves tokens negative
- newDispatcher enforces RemoteGuard's order: unknown remote, per-player token bucket, schema validate, kill switch disabled, optional authorize
- mergeStrikes unions two server lists, deduplicates by id, drops out-of-window and future timestamps, and sorts ascending by at (tie-break id)
- allowFeature allows all levels for play, Unknown/Standard/Full for trade, and Standard/Full for ranked
- challenges/security-at-scale.luau prints TEST PASS for all 15 checks
Step 10 of 10
Recap
Retiring the analogy
You no longer need “a single stadium turnstile with one ticket scanner and one clicker counter”. A single wrapper guarantees every remote enforces rate limits, shapes, permissions and logging consistently, but it still depends on sound game rules inside handlers and a kill switch to disable a misfiring check.
Recap
- RemoteGuard checks rate, schema and permission in order. The optional feature switch arrives at m17-live-season and runs after the schema check, before permission. Server-only remotes act as directional honeypots.
- Token buckets allow natural short bursts while capping sustained floods far below Roblox's ~500 requests/second shared remote limit; always clamp refill to capacity and clear buckets on PlayerRemoving.
- StrikeService merges recent strikes with DataStore UpdateAsync and shares new strikes on ExploitStrikes. ExploitWatch scores the record.
- Use Device Trust on the server as one layer alongside validation, handle Unknown and Studio Pending explicitly, and rely on Script Capabilities rather than client obfuscation for containment.
A shared remote validation wrapper is a single stadium turnstile with one ticket scanner and one clicker counter, until a guest with a real ticket still exploits a rule bug inside the stadium, or a faulty scanner locks out honest visitors across every gate.
Queued for review
- At m14-ship, Beacon Yard has three client-to-server remotes: Swing, SetSetting and ShopBuy. Which one has no per-player rate limit in its server listener?
- Starting right after the Run cell above (tokens = 0.0 at t = 11.0, capacity = 3, refillRate = 1), what does consume(shopBucket, 50.0, 1) return, and how many tokens remain?
- A player teleports on Server A (strike s2, weight 3), leaves, and triggers a speed strike on Server B (strike s4, weight 1) ten seconds later. Why should the strike service merge each save with UpdateAsync?
- You gate a new Beacon Yard trading booth to only Standard and Full devices, blocking Unknown. What happens to honest players on Windows, macOS and iOS today?