Find every line where a claim from a player's machine becomes a decision on yours, and the three questions that audit each one.
Every online game is two computers disagreeing politely. The 's machine decides what the wants to do. Your server decides what actually happens. A trust boundary is the exact line where a claim from the 's computer reaches code that can change real state — coins, inventory, a save file, the leaderboard. This section is about those lines: finding them, judging them, and closing the ones that are open.
The word that matters is claim. On the client's side of the line, a value is a wish: the clicked, the owns a sword, a hop costs five coins. On your side, it's a fact your game is now stuck with. Nothing that crosses left to right is evidence of anything — it's a sentence spoken by a machine the controls completely.
Two , one boundary:
-- LocalScript: a claim leaves the player's machine
coinEvent:FireServer()
-- ServerScriptService: the claim arrives as an argument, not a fact
coinEvent.OnServerEvent:Connect(function(player)
player.leaderstats.Coins.Value += 10
end)
That second snippet is the boundary in the clicker: the moment OnServerEvent fires, code that owns real data starts acting on a message from outside. Whether that message is honest is not something the server can read off it.
Which of these is a trust boundary?
FireServer and OnServerEvent are not two features. They are the two ends of one line: the call that speaks and the handler that listens. That pairing is the canonical trust boundary on Roblox for two reasons.
First, it is the only place a client's code can reach a server's code. If a value never crosses a remote, a client can't put it there.
Second, the handler's argument list is a list of claims. Look at where each one comes from:
buyEvent.OnServerEvent:Connect(function(player, itemId, price)
-- player: filled in by Roblox from the connection — server-derived
-- itemId: whatever the caller typed — client-owned
-- price: whatever the caller typed — client-owned
end)
player is safe because Roblox itself supplies it from the connection: the caller cannot make it point at somebody else, and it cannot make it point at nobody. Every argument after it came from the other machine.
In buyEvent.OnServerEvent:Connect(function(player, itemId, price), the argument that Roblox fills in from the connection — and which is therefore server-derived — is .
Sorting every value in your head into two columns is the whole skill. Ask one question: could the have made this number up?
player; anything a LocalScript computed (a price, a reward, a timer, a position, a health value, an item id); anything the 's own clock produced.player object; leaderstats values your server writes; anything read back from a ; anything the server looked up in its own .A client-owned value is fine to receive. It is never fine to act on directly. The fix is always the same shape: take the claim, then re-derive the number on your side of the line.
local REWARD_PER_CLICK = 10
clickEvent.OnServerEvent:Connect(function(player, amount)
-- the client still gets to pick the payout
player.leaderstats.Coins.Value += amount
end)
The client should not choose its own payout. Replace the client's number with the server's constant.
Once you can see the lines, judging them is a checklist. For each one, all three answers must be yes:
The questions only ever change in their details. A chat handler, a buy button, a save trigger, a "claim daily reward" remote — same three checks, different constants.
A handler refuses anything that isn't a number, and reads the price from its own catalog. A single player can still fire it a thousand times a second. What is the finding?
When a boundary fails, you have two ways to fix it and only one is right. You can try to detect a lie — compare the claim against what you expect, look for suspicious patterns, guess at the 's intent. Or you can stop needing the claim at all: move the number to your side of the line, where nobody outside your server can name it.
Detection is a race you lose eventually, because the attacker gets the last word. Re-derivation ends the conversation: the request asks may I? and the server answers with a number it already owns.
-- weak: the claim is used
coins.Value += amount
-- strong: the claim is received, then replaced
local amount = REWARD_PER_CLICK
coins.Value += amount
The client reports its own score. Fill in the guard that drops the request unless the reported value is actually a number — before anything adds it to the leaderboard.
scoreEvent.OnServerEvent:Connect(function(player, score)
-- only real numbers get past this line
player.leaderstats.Score.Value += score
end)Before you write another feature, draw the map once. It is five lines long and it is the entire security surface of a small game:
FireServer( and OnServerEvent. If the two numbers don't match, you've already found a bug.The dangerous boundaries are the ones you forgot you wrote: the debug remote you added on a Tuesday, the "skip intro" flag from a prototype, the save trigger that takes a slot name. An exploiter reads your map by searching for the same strings you would — so the boring, un-remembered remote is the one that bites.
Next up: rate limiting and spam — pacing every door on that map, and why a client's own timer is never evidence.