Most effective way to detect noclip?

The title is pretty self explanatory but to further understand what I’m trying to ask.
I’ve researched the topic a lot on preventing noclip and heres what I’ve tried and why it has failed.

~ Place a very tiny part inside the center of the torso or humanoidrootpart and weld it. Whenever this part gets touched teleport the player to a location they were in prior to the part getting touched.
RESULT: This worked perfectly and didn’t cause any lag or game issues. This was the perfect solution until sadly I realized you could still teleport past a wall. This only prevented you from sitting inside of walls, unfortunately.

~ Raycast every frame on the server from previous location to new location and see if anything gets in the way. (This is the most commonly suggested method.)
RESULT: It worked pretty well tbh. However with just 5 - 10 players the server would start lagging and eventually crashed. The reason behind this was probably because my raycast function was different. It would raycast and if it hit a part that had cancollide off it would add it to a blacklist and raycast again and keep doing this until there is nothing left to be blacklisted and the raycast could complete. I was forced to do this since my game had a lot of hitboxes and invisible parts.

Whats an effective way to stop noclipping that wont cause lag?
Even if you don’t have a full answer any information or suggestions you have would be greatly appreciated! Thank you all in advance!

1 Like