Hi! I’m currently working on an Anti-Cheat for my game and I need your help testing it.
Currently, it has:
Anti-no clip
Anti-speed
Anti-fly
Anti-teleport
Detects messing with your character and kicks you
Other details
Punishments will be more harsh the more times you get punished within a certain time period
No-clip has great performance since it is most times performing one raycast every 15 heartbeats. It puts the players positions into a cache so it can do more precise checks if triggered.
Antifly only does 1 raycast every 3 heartbeats
Let me know what you think!
I supplied some things in-game to test it like client sided speed changers, flying carpet, client sided non collidable part, etc
Every heartbeat the players position is cached into a table.
Every 15 heartbeats it will do a “sleep” check and raycast from the last checked sleep position to newest position. If it detects something is blocking, it will do a more precise check using the table with cached positions and that will decide if they should be punished.
Yup. The 15 heartbeats can also be raised so it’s raycasting less, but will be doing precise checks more often since it gets falsely tripped more often.
Here’s an image to visualize it how this works:
Black = walls
Orange = the players path
Green = sleep checks. You’ll notice it goes through the wall so it trips it and does a precise check
Purple = the precise checked positions. The precise check decided they shouldnt be punished
Pretty neat idea. You could potentially couple this with ‘ignoring’ a few heartbeats if the player doesn’t move.
local RunService = game:GetService("RunService")
local Threshold = 0.1
RunService.Heartbeat:Connect(function()
local NewPosition = HumanoidRootPart.Position
if (OldPosition - NewPosition).Magnitude < Threshold then
print("Ignored! Didn't move!")
end
OldPosition = NewPosition
end)
This could save performance if the player has sketchy movement and the player didn’t really move for a few frames since the server won’t need to raycast between 15 positions but possibly 14, or 10, any number really.
Since I can’t see your code I’m not sure if you’ve done these, but these are some performance saving methods I’ve found while trying to create my own movement anticheat:
Cache the Raycast.FilterDescendants and reuse it. Use a connection like workspace.ChildAdded to register more BaseParts into the filter. That’s only necessary depending on your game.
Use Parallel Lua.
Don’t check for cheating once you’ve taken away NetworkOwnership. Also there are hacky ways for exploiters to regain NetworkOwnership even if you take it away, so I suggest checking every frame while they’re ‘punished’ to make sure their NetworkOwnership isn’t returned until a time limit or whatever is done.
After a serverside anticheat is done, you can try to make a clientside one. It detects ‘script kiddies’ that just change their WalkSpeed. Something I do is send all Humanoid data from the client and check it on the server to make sure they match. Honeypots are cool too.
Also sorta small but you can ignore objects with collision if it doesn’t matter if someone noclips through them. For example a door mat or a small lamp on the wall. The bigger the Raycast.FilterDescendant table, the more performance it takes. This borders on micro-optimization though so be careful.
Also, did you use any code from ForbiddenJ’s anticheat? It’s open sourced and has a lot of math-y detection that I find invaluable.
Currently for the game I’m going to use this with, I only have the FilterDescendants static objects like walls on buildings. Things like lights, chairs, tables, etc doesnt really matter if they clip through them.
Never tried using parallel lua, ill look into it
I never knew about this, instead of disabling the checks and checking if their networkOwnership is still nil, I’d rather just keep the checks going as that would be a pretty small optimization.
This is something I already plan on making, this place is just a test place for the sever-sided part of the anticheat.
Yup, the anti-speed and anti-fly mostly use stuff from his anticheat. I made some changes like using the humanoid FloorMaterial to check if they’re grounded since his anticheat did a bunch of raycast checks that the Humanoid object already does to check for the floor. I also removed checking for moving parts around the player since there wont be many moving parts in the game im using this for.
I looked into using FloorMaterial but never got around to using it as it seems like one of those grey-area properties where you don’t really know if exploiters can change it or not.
I wanted to use it because it’s way more performant than raycasting 4-8 times per frame to find the part the player is standing on so I think I’ll take a look at it again.
You can approximate the interval where the player gets kicked back to its original position and within that short timeframe where it’s not kicking you back you can quickly teleport great distances as long you immediately teleport back.
If you for example have any game with PvP this won’t be suitable. If it’s an obby you’d have to go the extra mile to prevent prevent people from just teleporting to a spawnpoint like this.
(nevermind read it wrong, still what below applies)
If you mean the short period between when they walk through a wall and it detects that they did, there isn’t really a solution to this because even if I checked every heartbeat there would still be the same problem
You’d solve this and all other character related cheats if you used something like Chickynoid where instead of the client having network-ownership of the character model you instead let the server own it by using something like remoteevents to send over keybind data to the server.
Yes, it’s network intensive for the server but it’s the only approach for now unless Roblox decides to let us create a middle-layer and allow us to directly manipulate client to server network data.
You’ll sort of re-make how network-ownership works, so the character model becomes server owned and the server moves the character for you. That way no one can’t mess with animations or physics.
You’ll still have to make sure the client can move the character just how they want so as to not be bothered with latency but other people will only be able to see the real server-owned charactermodel.
The anti-cheat system that you made is fantastic because when I try to fly by using the flying rainbow carpet, it sends me back to the place before I attempted to fly.
Yup, this is definitely a solution but I dont plan on switching over to a solution like that because it would require a huge chunk of the game I’m working on to be changed.
This isn’t reliable, clipping through and back within 15 heartbeats is possible. Even if for certain walkspeeds it wouldn’t be, for others it will, so this isn’t customizable. It’s best to implement either a server-controlled character, or raycast continuously/use GetPartsInBoundingBox.