There is an easier way to solve glitching through walls.
You can just add a script that draws a ray from a player’s last path to their new path and if they went through a wall they are just teleported back to the last good position.
If you wanna take a look at the resource I made for that you can just look here: