Hey guys, I’m trying to create a script to stop players noclipping through the map (eg noclipping through a wall of a building) however I’ve hit some issues. The main issue is that if the object is too thin the script doesn’t register that the player has passed through the map and therefore doesn’t stop them (presumably because the player is moving faster than the script is checking player position).
The script so far:
hook.Add( “Tick”, “inWorldCheck”, function()
for _, ply in pairs( player.GetAll() ) do local plypos = ply:GetPos() local inworld = util.IsInWorld( plypos ) if inworld == false then local plyang = ply:GetAngles() local backdir = -plyang:Forward() * 65 ply:SetPos( plypos + backdir ) ply:SetMoveType( 2 ) end end