How can you stop camera noclipping with a script

Hello! I have this bug in my game were a player can noclip with their camera


Is their any script or something that could fix this? Help appreciated !

1 Like

You could offset your camera by adding your camera’s CFrame with a CFrame.Angles.

CFrame = CFrame + CFrame.Angles(0,10,0)
--The CFrame's orientation now has 10+ on the Y axis.

Since your camera looks like it’s clipping through the front, you can add a negative Z on the orientation.

camera.CFrame = camera.CFrame + CFrame.Angles(0,0,-2)
1 Like

Thanks This worked well! Appreciated

1 Like

You can also shorten the script by specifying that you want to add by itself and another value:
Before:

camera.CFrame = camera.CFrame + CFrame.Angles(0,0,-2)

After:

camera.CFrame += CFrame.Angles(0,0,-2)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.