Skip to content
Tutorials Center
My learning

Topics

Lesson 31 of 37 ยท Multiplayer and Security

Anti-Exploit Security: Never Trust the Client

Learn how exploiters attack Roblox experiences and how to defend with server-side checks, sanity limits, network ownership awareness, safe remotes and good logging.

Any popular experience attracts people who try to cheat. They use third-party tools, called exploits, that run their own code inside the Roblox client on their computer. This is against Roblox's rules, and Roblox works to stop it, but as a developer you must still build your experience assuming some clients are hostile.

The good news is that Roblox's design already protects you if you follow one principle: the server is the authority and the client is untrusted. This lesson turns that principle into practical patterns. The Roblox code is shown read-only; the runnable examples are JavaScript stand-ins for the checks.

What an exploiter can and cannot do

An exploiter controls their own client completely. They can:

  • Read everything that replicates to their client, including scripts in ReplicatedStorage, StarterGui, StarterPlayerScripts and Workspace.
  • Run their own LocalScript-level code and change their own copy of the world.
  • Fire any RemoteEvent or invoke any RemoteFunction they can see, with any arguments they like, as often as they like.
  • Change their own character's movement, since the client has network ownership of the character.

They cannot, in general:

  • Read or change server-only containers such as ServerScriptService and ServerStorage.
  • Make the server believe a client-only change.
  • Change what the server saved.

So the dangerous surface is mostly your remotes and anything you trusted the client to decide.

Where cheaters attack

Remotes Forged arguments, spam.
Character Speed, teleport, fly.
Visible code Anything replicated can be read.
Trusted values Prices or damage sent by the client.

Defend by checking everything on the server.

1 / 2

Rule 1: validate every remote

You have learned the three questions: shape, permission and frequency. Apply them to every OnServerEvent and OnServerInvoke handler, with no exceptions. A handler that looks harmless can become a weapon:

LUA
-- DANGEROUS: the client picks the target and the amount
damageRemote.OnServerEvent:Connect(function(player, target, amount)
	target.Humanoid:TakeDamage(amount)
end)

An exploiter fires this with any player as target and math.huge as the amount, and kills everyone. The safe design lets the client say only "I attacked" and the server decides who was hit and how much:

LUA
attackRemote.OnServerEvent:Connect(function(player)
	if not canAttack(player) then return end -- cooldown, alive, has weapon
	local weapon = getEquippedWeapon(player)
	for _, target in findTargetsInRange(player, weapon.Range) do
		target.Humanoid:TakeDamage(weapon.Damage) -- server-owned numbers
	end
end)

Rule 2: use sanity checks

Even when the client must report something, check it against what is physically possible.

LUA
local MAX_REACH = 12 -- studs

local function isInReach(player, targetPosition)
	local character = player.Character
	local root = character and character:FindFirstChild("HumanoidRootPart")
	if not root then return false end
	return (root.Position - targetPosition).Magnitude <= MAX_REACH
end

Other common sanity checks: speed (distance travelled divided by time), cooldowns (time since last use), line of sight (a raycast on the server), ammo count held by the server, and "is the player alive and in the round?"

Rule 3: keep secrets and rules on the server

Do not put loot tables, drop chances, admin lists, API keys or webhook addresses anywhere a client can read. Anything in ReplicatedStorage or a LocalScript is public. A rare-drop odds table stored in a ModuleScript in ReplicatedStorage lets an exploiter read exactly how to predict or reproduce your system. Put such modules in ServerScriptService or ServerStorage and send only results to clients.

Never use loadstring or require on a module id that comes from the client, and never run strings sent by a client as code.

Rule 4: remember the character belongs to the client

For smooth controls, Roblox gives the player's client network ownership of their own character. That means speed hacks and teleports in movement often cannot be fully prevented by the engine. Your defense is to detect impossible movement on the server and respond (reset position, ignore rewards, flag the player), while keeping gameplay-critical actions on the server.

LUA
-- Called on a timer for each player
local function checkSpeed(player, lastPosition, dt)
	local root = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
	if not root then return lastPosition end
	local speed = (root.Position - lastPosition).Magnitude / dt
	if speed > 100 then -- far above the max walk or sprint speed
		warn(player.Name .. " moved suspiciously fast:", speed)
	end
	return root.Position
end

Tune limits generously. Lag, vehicles and legitimate dashes can look suspicious, and kicking an innocent player is worse than letting a minor cheat pass. Prefer soft responses (reverting a position, withholding a reward) over instant bans unless you are certain.

Runnable: a cooldown and a reach check

JS Server-side checks for an attack (JavaScript stand-in)

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Ana's spam is blocked by the cooldown, Cy is far from everyone so no one gets hurt, and damage and range come from server data, so a forged request cannot change them.

A speed monitor

JS Detecting impossible movement

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Logging and a layered defense

No single check is perfect. Combine them:

  • Log unexpected requests (player id, remote name, arguments) so you notice patterns.
  • Escalate gently: ignore the request, then warn, then temporary removal from the round, and use bans only for repeated, clear abuse.
  • Keep server code readable and test it with hostile inputs, such as negative numbers, huge numbers, wrong types and rapid repeats.
  • Report real exploiters through Roblox's tools; do not rely on obscure code, since anything on the client can be inspected.
  • Do not store anything on the client that you would not want a player to see.

Do not try to "detect exploits" by scanning a player's client for known tools. Clients can lie about the result. Check what the server can verify: values, timing and physical possibility.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. An exploiter fires your RemoteEvent with any arguments they want. What is the right defense?

    You cannot stop clients from sending values, so the server must check every argument and decide the outcome.
  2. 2. A sword's damage value should be

    Server-owned numbers cannot be forged. The client should only request the action.
  3. 3. Where should a loot table with secret drop rates be kept?

    Only the server-only containers hide data from clients.
  4. 4. Why is a speed check on the server only a "detect and respond" tool?

    The client has network ownership of its character, so you detect impossible movement and respond instead of preventing it outright.

Summary

  • Assume the client is hostile: exploiters can read replicated content and fire any remote with any arguments.
  • Let the client request actions only; the server owns damage, prices, cooldowns and results.
  • Add sanity checks (reach, speed, cooldown) and rate limits, and keep secrets in server-only containers.
  • Character movement is client-owned, so detect and respond softly rather than banning on a single signal.
  • Log suspicious activity and test your remotes with hostile inputs.

Next: Publishing Your Experience