How can I properly make anti-cheat for a +1 Speed Escape Obby?

Hello, I’m currently making a +1 Speed Escape Obby, but the only thing I’m not sure how to handle correctly is the anti-cheat system.

I want to prevent players from using things like:

  • Flying
  • Speed hacks
  • Teleporting / noclip
  • Other exploits that let them skip levels even when they don’t have enough speed

The main goal is to make sure players:

  • Can’t pass levels if they don’t actually have enough speed
  • Can’t claim rewards by exploiting (Stage Rewards)

Does anyone have any good ideas or best practices for handling this properly?

2 Likes

handle as much as possible on server except animations, or at least the validation

I have a possible solution for this anti-cheat system of yours:

You could design the anti-cheat to constantly verify that a player’s actual movement matches their in-game stats, ensuring their character hasn’t been modified. For example, if someone only has +3 speed but is moving far faster due to a cheat modification, the system would detect that mismatch and flag it. I’d also recommend building in multiple layers of checks and safeguards so the anti-cheat is harder to bypass.

For flying, you can handle it by validating whether the player is grounded or within expected vertical movement limits. Track how long a player stays in the air and compare it to what’s normally possible.

For teleporting and noclip, you can handle it by keeping an eye on how players move between updates. If someone suddenly jumps way farther than they should based on their speed, that’s a pretty clear sign something’s off, so you can flag them or move them back. For noclip, you can check if a player is in a wall, which will flag them. I’d highly recommend making the anti-cheat kick the player out instead of perma-banning, due to false positives if a player was stuck without the use of cheats (similar to Forsaken).

6 Likes

By the way, when you’re working on the flying phase of the anti-cheat, make sure the anti-cheat doesn’t flag players falling instead of flying. I’ve made this same mistake before, and had to scrap the whole idea.

2 Likes

Roblox has a new “Server Authority” beta (or has had it for a while), and it should get out of beta sooner or later
I recommend reading into it. Some differences are that you wont be able to set the walkspeed on the client, you wont be able to fly, float or exploit your movement anymore

If your game isnt that complicated (which shouldn’t be for something like this), then you can safely make the game around this server authority, and once it releases for the live game as well, you’ll be safe

2 Likes

Hello!

What you could do for the fly hacks is add an invisible wall above the obby, and if the user touches it, they get kicked from the game or temporarily banned.

For the speed hacks that could be done by detecting, for example, if the user’s speed is above the speed that they should be at, then they get kicked, so for example, if the user is meant to have 30 speed, if they have anything above that, then they get kicked.

Here is a little example of the speed hack anti-cheat that you could develop.

Put this in a server script and in serverScriptService

local maxspeed = 15 -- you can set this to be dynamic if needed
local chances = 3
local personschances = {}

game.Players.PlayerAdded:Connect(function(player)
	personschances[player] = 0 
		player.CharacterAdded:Connect(function(char)
		local human = char:WaitForChild("Humanoid")
		print("working")
		while char.Parent do
			print("worked but just waiting")
					task.wait(5)
			if human.WalkSpeed > maxspeed then
				if personschances[player] == 3 then 
					player:Kick("Kicked")
				else 
					personschances[player] = personschances[player] + 1
					human.WalkSpeed = maxspeed -- This changes the users speed back to the max speed
					print("SHOW A WARNING UI TO THE USER TO NOTIFY THEM")
					print("Users chances are ".. personschances[player].. "/3")
				end
			else 
				print("Players speed is normal")
					end
				end
			end)
	end)


game.Players.PlayerRemoving:Connect(function(player)
	personschances[player] = nil -- removes the players chances :)
end)

What this does is check whether the user’s speed exceeds the maximum speed. If it is, it sets their speed back to the max speed and gives them a “warning,” then if they get 3 warnings, they get kicked. This is a very basic script to give an idea. If there is anything I can help with, feel free to reply, and I will help you when I can.

stop using chatgpt plz its uncanny

1 Like

I don’t use ChatGPT for DevForum, unless it’s specificly for formatting a post. :smiley:

3 Likes

ok ok sorry but ur writing style is def inspired by chatgpt
like 15% is crazy

no it isnt its 74 % human how is that ai, also the online ai detectors are really inaccurate

No worries, I’ve been practicing a lot of English recently for the extra grade in class :slight_smile:
By the way, AI-Detectors aren’t accurate or should be used as definitive proof whatsoever.

2 Likes

thats quite rude, assuming his country because of the way he speaks. Please rethink your comment

Thats great, your English is very good, and yes AI detectors are really bad

  1. i don’t think thats true
  2. How would you even know that? Unless u use ai

i know how to use google and search for ai checker

assumptions arent bad, some level of assumption is needed for efficient communication

:woozy_face:

--ServerScript in ServerScriptService

local maxSpeed = 20
local speedIncrement = 1
local defaultWalkSpeed = 16
local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		local humanoid = character:WaitForChild("Humanoid")
		local loopActive = true

		humanoid.Died:Connect(function()
			loopActive = false
		end)

		while loopActive do
			if humanoid.MoveDirection.Magnitude > 0 then
				humanoid.WalkSpeed = math.min(humanoid.WalkSpeed + speedIncrement, maxSpeed)
			else humanoid.WalkSpeed = defaultWalkSpeed
			end	task.wait(0.5)
		end
	end)
end)

To beat this you would have to pretty much make your experience unplayable.

This method does not work; when an exploiter changes their speed locally, your server-sided script will not detect that change. The method posted by @2112Jay will suffer the same fate.

Writing this as a LocalScript is borderline pointless, as any exploiter educated enough could just remove that script locally. Adjusting WalkSpeed isn’t the only way people go faster, either.

You can use the code below to test.

  1. Put it in ServerScriptService
  2. Run the game
  3. Change your speed locally (Workspace > Character > Humanoid > WalkSpeed = 100)
  4. Nothing happens, your speed is still 100.

Now, switch to the server view while playing (looks like a little monitor, icon below) and change your character’s speed there. A print statement will be outputted and the character’s speed will be changed.

Code

local Players = game:GetService("Players")

local DEFAULT_WALKSPEED = 16
local MAX_WALKSPEED = 20

local function onPlayerAdded(player: Player)
	local function onCharacterAdded(character: Model)
		task.wait()
		
		local humanoid = character:WaitForChild("Humanoid")
		if not humanoid then return end
		
		humanoid.Changed:Connect(function(property: string)
			if property ~= "WalkSpeed" then return end
			
			print("Player", player.Name .. "'s WalkSpeed changed to", humanoid.WalkSpeed)
			
			local magnitude = humanoid.MoveDirection.Magnitude
			if magnitude > 0 then
				humanoid.WalkSpeed = math.min(DEFAULT_WALKSPEED, MAX_WALKSPEED)
			else
				humanoid.WalkSpeed = DEFAULT_WALKSPEED
			end
		end)
	end
	if player.Character then
		onCharacterAdded(player.Character)
	end
	player.CharacterAdded:Connect(onCharacterAdded)
end

Players.PlayerAdded:Connect(onPlayerAdded)

For a 1/2 of a second, then correct it before you’ll even notice, and it’s constantly doing that.
“To beat this you would have to pretty much make your experience unplayable.” ←

There is no use talking to someone who worships hackers.
Next will be the crying over the post as if that means anything.

<_< The topic is about exploiting/anti-cheat. In that case, your code won’t run at all if an exploiter changes their speed locally.