How could I limit the camera to not be able to rotate fully?
Code so far:
local lockCamera = false
function lockCam(bool, ang, min, max)
lockCamera = bool
if lockCamera == true then
if ang.X > 0 and ang.Z > max then
local angle = Vector3.new(ang.X, ang.Y, max)
camera.CFrame = CFrame.new(camera.CFrame.Position, angle)
elseif ang.X > 0 and ang.Z < min then
local angle = Vector3.new(ang.X, ang.Y, min)
camera.CFrame = CFrame.new(camera.CFrame.Position, angle)
end
end
end
Where ang being the lookvector of the camera and min and max being set to 0.99 and -0.99.
Video of this:
https://gyazo.com/f00c2eb5e502f98bb4546099a82f02cd
Please help me, I’m in a rush!