Could coding an anticheat for a physics based game (body movers) be possible?

I think the title explains itself. I am working on a game that depends on body movers, mainlly body velocity and im wondering if i should use something else instead or if there is a method on how this can be achieved, without involving WalkSpeed of course.

1 Like

You’d do what all movement anti-cheat does: detect movement that shouldn’t be possible. It would be different than regular anti-cheat but definitely not impossible.

		local delta =
		local ms = 500 --It's like wait(0.5)
		local maxRange = 20
		local oldPos = nil
		local enabled = true -- If in a moment, the player must be teleported
		local hrp = chr:WaitForChild("HumanoidRootPart")
			if (>=ms and oldPos~=nil and enabled then
				if (hrp.Position-oldPos.Position).Magnitude > maxRange then
					--He has teleported or have big walk speed
				delta =
			oldPos.Position = hrp

This seems like an average anticheat to detect player a walkspeed cheat, what i want is the game to detect whether the player is moving fast because of the body movers inside the character or because they are cheating.

Do you have any suggestions where i could get some references?

in my experience it’s pretty difficult, I used a RunService Heartbeat loop to check a lot of things, like:

  • the distance travelled between the previously recorded frame and the current frame
  • the average of the distance travelled in about a second
  • the player’s vertical movement and distance to the nearest floor in the past few frames (to check if the player is floating)
  • distance between all limbs
  • raycasts between previous and next frame

if it detects anything odd it just teleports and resets the velocity of the player to the last recorded frame

it’s pretty stressful on the server and I could’ve optimized it much better, players will sometimes randomly rollback since physics aren’t 100% reliable (and sometimes players simply don’t have the best connection), but I noticed that exploiters don’t bother with anything movement related since they’d get hit by the anticheat so much, so in the end it’s somewhat possible and it does work! now they just go for aimbot related hacks (very fun to deal with!)

1 Like

I think most people kind of just make it up as they go then run it against play testing with trusted players to tune it.

Lightning_Splash has a ton of experience with anti-cheat, RU has virtually zero movement exploiters.

It really depends a lot on your game. I could give more suggestions if I knew more about it. LS gave some great examples of things to check. Basically you want to check movement values and compare them with what should be possible (compare velocity+acceleration with the character’s state, like running, falling, sliding, jumping, etc). If they seem impossible then you respond usually by moving them back.

A good solution is for custom movement is usually heavily tailored to your game. When tuning it also make sure to do lots of testing and noting which things are getting tripped to make tuning decisions.

1 Like

Well, the thing is the game is all about movement and since its pvp im worried that players will teleport or fly or do stuff like that, im gonna do my research on anticheat measures and see what i can do.