Development / ROBLOX
Roblox RemoteEvent validation: a reward contract and failure tests
Design a three-checkpoint training route, decide which messages the client may send and test invalid, repeated and unusually fast reward requests.
What we are designing #
This walkthrough designs a small reward system for a training route. A player visits three checkpoints in order and receives five virtual coins. Names, numbers and rules are invented for this exercise; they do not describe a feature already installed in our games. This is a design and test plan rather than a script to paste into production.
The deliverables are a message contract, a server-state diagram and a test matrix. Implement them in a separate test project first. Success has two parts: a valid route awards once, while a rejected request leaves both balance and progress unchanged. A friendly button animation alone cannot demonstrate either result.
1. Write the route rules first #
Call the checkpoints start, bridge and finish. Use a starting test balance of 100 coins, a reward of 5 and a maximum distance of 12 studs from the relevant fixed checkpoint. Our exercise also requires at least 12 seconds for the entire route. Measure that condition on the actual test map; it is not a suitable number to copy blindly into every game. Boosts, teleports and shortcuts may need different rules.
Keep a separate attempt for each player: attempt state, next allowed checkpoint, start time and completion marker. Beginning another run is a separate server-approved action. A repeated finish message must not silently create a fresh attempt. Separate starting again from receiving the completed-route reward before designing the interface.
2. Define a narrow message contract #
In Explorer, create a RemoteEvent named RouteCheckpointRequest in ReplicatedStorage. The client expresses an intention to mark a checkpoint by sending one short identifier: start, bridge or finish. Do not add parameters for reward amount, current balance or a player to reward. None is needed to select this action. OnServerEvent supplies the calling Player as the handler’s first parameter.
A separate RouteCheckpointResult event can report the decision to that player. Disabling a button and showing “please wait” helps usability, while the server changes reward state. Decide the response vocabulary in advance: accepted, not_ready and retry_later are enough for this example. Receiving accepted should update presentation, not authorize the client to create coins.
3. Prepare the server’s own data #
Keep route logic and rule tables in ServerScriptService. Decorative objects may remain visible in Workspace, but the amount and permitted sequence come from server data. Map each allowed identifier to a known checkpoint. Do not resolve an arbitrary object path supplied by the client or load a module chosen in its request. A small fixed lookup makes this exercise easier to inspect.
The training checkpoints are anchored so ordinary physics does not move them to a player. Distance is still only one condition, not proof that the entire route was legitimate. If your game allows client-controlled movement, design movement validation separately. Remove temporary attempt state and request counters when a player leaves; another player must never inherit them.
4. Check the message before changing progress #
Apply a small per-player server request limit, then validate argument count and the checkpoint string. Our contract accepts exactly one argument, no more than 16 bytes long, matching one of three known identifiers. nil, a table, an Instance, a number or an extra argument does not match this shape. Check length before performing expensive string processing. Rejection here must not modify route progress.
This action does not accept client numbers at all. If a later feature adds quantities or coordinates, define type, finiteness, range and meaning for every value. Add NaN and infinity to that feature’s tests: being a number is not enough for arithmetic. Avoid an unrestricted table of arbitrary properties merely to make the contract “future proof”.
5. Compare with the current attempt #
Read current server state after the basic checks. In our exercise, the character must exist and be alive, the attempt must be open and the identifier must equal the next expected checkpoint. Measure distance from the server’s known checkpoint. At finish, also check total route duration. Every refusal happens before updating either progress or balance.
For example, a player has marked start but sends finish. finish is a valid identifier, yet bridge is the next allowed action. Another player may stand beside bridge without having started an attempt. Do not silently repair either situation by issuing a reward. Return an understandable refusal and retain the normal permitted path forward.
6. Separate request frequency from duplicate rewards #
For testing, choose at most one processed request per player every 0.5 seconds. This is our local exercise rule, not a universal Roblox setting. It reduces work during a series of calls. Tune a real limit using interface and latency measurements; an ordinary double click can produce rapid requests. A single rejected call should not automatically become a permanent ban.
An infrequent repeated finish must still never add another five coins. A closed-attempt marker handles that independently of the timer. If handlers can wait between checking state and changing it, two may observe the same old state. Design a short check-and-commit section without yielding, or an explicit queue/lock that rechecks conditions after any wait.
7. Commit completion as one logical action #
Successful finish has two linked effects: the attempt closes and the test balance changes from 100 to 105. Do not add coins first and decide independently later whether the route was complete. The closure must prevent another success before the next request is handled. Send the result and refresh presentation only after the server makes this decision.
This design covers the state of one running server. Persistent rewards across sessions require a separate saving, retry and recovery design. A flag in memory does not guarantee exactly one award after rejoining. Do not attach a DataStore write to every incoming click. First define the consistent state change, then decide how it will be saved and recovered.
8. Run positive and negative checks #
Use a separate Studio test project with a server and two clients. For player one, follow start → bridge → finish with permitted distance and timing. Let player two run an independent attempt at the same time: player one’s progress must not act as shared state. Reset documented initial conditions for each experiment so that an earlier failure cannot hide the next.
Use your own test client to send prepared invalid values to this exercise’s event; an external exploit tool is unnecessary. Observe server balance and attempt state, not just the label on a button. For simultaneous finish requests, also count successful awards. The matrix below describes expected outcomes; it does not report tests performed on our published games.
| Check | Setup and request | Expected outcome |
|---|---|---|
| Normal route | 100 coins; start → bridge → finish, ≥12 s, near each point | Balance 105; one closed attempt |
| Two players | Independent valid route for each | Each receives their own +5 |
| Wrong shape | nil, number, table, Instance or extra argument | Reject; balance and progress unchanged |
| Unknown string | other or a string longer than 16 bytes | Reject before checkpoint lookup |
| Wrong order | finish immediately after start | Reject; bridge remains next |
| Too far | Expected point, distance above 12 studs | Reject without reward |
| Too fast | finish before 12 s total duration | Reject without closing the attempt |
| Missing / dead character | Known identifier, invalid character state | Reject without progress changes |
| Double finish | Two finish requests sharing initial attempt state | At most one +5 award |
| Repeat after success | finish again after closure, even after the timer | +0; balance remains 105 |
| Request burst | More than one message in 0.5 s | Excess requests limited; no duplicate reward |
| Player departure | Leave during an unfinished route | Temporary state cleared; no inheritance |
9. Record findings and the design’s limits #
For every check, record setup, action, expected outcome, actual outcome, project version and date. Use short rejection reasons such as wrong_shape, wrong_order, too_far and already_completed. Bound logging volume during repeated requests: endlessly writing every rejection can create its own load problem. An anonymized, reproducible scenario is more useful to another developer than a huge unstructured log.
DevForum discussions help identify questions, but a general library does not know your map rules, economy or saving scheme. Neither this diagram nor a shared example guarantees complete security. Before applying the design to a new game, replace the invented numbers and test allowed movement, competing requests, player departure and failed saves. Official technical references and community discussions appear separately below.
Original sources
Roblox Creator HubRoblox Creator Hub — remote events and callbacks
DevForum — tannnxr: Keeping your game secure, protecting remotes (discussion)
DevForum — N0tKep: remote security guide (discussion)

