How to store the y angle so that the camera stays oriented when panning?

hey all, i am having an issue with my camera panning script. the script works fine for the most part, but when the camera is done panning, it reverts back to the original position. how can i make it so that it saves the current y angle of the camera?

local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local cam = game.Workspace.CurrentCamera

cam.CameraType = "Scriptable"

local camCF = workspace.gamer.CFrame
local angle = 0


RunService.RenderStepped:Connect(function()
	local center = Vector2.new(cam.ViewportSize.X / 2, cam.ViewportSize.Y / 2)
	local rotVector = Vector3.new((mouse.X - center.X) / 150, (mouse.Y - center.Y) / 150, 0)
	
	cam.CFrame = camCF * CFrame.Angles(math.atan(math.rad(-rotVector.Y)), math.atan(math.rad(-rotVector.X)), rotVector.Z)

	if mouse.X < 250 and angle > -180 then
		print("panning left")
		angle = angle - 1
		
		cam.CFrame = cam.CFrame * CFrame.Angles(0, math.tanh(-math.rad(cam.CFrame.Y + angle)), 0)
		wait(0.1)
	elseif mouse.X > 1750 and angle < 180 then
		print("panning right")
		angle = angle + 1
		
		cam.CFrame = cam.CFrame * CFrame.Angles(0, math.tanh(math.rad(cam.CFrame.Y - angle)), 0)
		wait(0.1)
	end
end)

the angle variable is the y angle.