Disable clipping through walls

I’m looking for a great way to disable being able to clip through walls in noclip mode. I tried a couple times but it was buggy. Does anyone know a great method for this?

I think you can just use

Entity:SetMoveType with MOVETYPE_FLY.

i tried that before, it works but its also not ideal for building because you just fly around