How would I go about creating anti noclip?

Hey guys!

The title says it all, How would I go about creating anti noclip? Where would I start from?

The first idea that comes to my mind is using spatial queries to periodically check ON THE SERVER if the player’s character is inside any part of the map
https://developer.roblox.com/en-us/api-reference/function/WorldRoot/GetPartsInPart
Do note that to minimize false positives (where the player is simply just hugging a wall) you will need a smaller hitbox and run the check on most, if not all body parts

I cannot stress enough the importance of having a serversided anticheat. Anything that’s on the client can be manipulated to your disadvantage, and that includes anticheats

1 Like

Could I just check if the HumanoidRootPart of a character is in a part?

Also, can you give an example of GetPartsInPart?

I’m not sure how reliable it would be to only check the HumanoidRootPart. It can touch a wall, for example, and because of the impreciseness of physics, it clips into the wall just a teeny tiny bit which will still trigger the anti-noclip detection.

And as for an example, here’s a demo:
anti noclip thing i guess.rbxl (41.2 KB)
It uses an invisible microscopic part as the hitbox for noclip detection, which follows the HumanoidRootPart
It will print out in the output whether or not you’re currently inside of another part

a more performant method would be to raycast between the humanoidrootparts position and between a older logged position

Not always reliable; I imagine there being a weird edge case where the player goes around a corner or pole and the obstacle gets caught up in the raycast which causes a false alarm

yes ive already thought about that in that case u can use GetPartsBoundInBox within the HumanoidRootPart with a very small size to make sure theyre in a part if the raycast hit something

I’m using GetPartsInPart over GetPartBoundsInBox because the latter only considers the cuboid volume that the parts take up, whereas the former takes into account the actual shape and geometry of the parts which makes it more accurate
This is important for a map where there’s probably going to be many complex meshes and shapes