How to rotate camera based on mouse direction?

This is what I have, but the camera kinda just snaps back. How do I make it so I gradually rotates the camera / or not make it snap back?

edit:
I have found a solution.

	runService:BindToRenderStep("RotateCameraInDirectionPlayerIsGoing", Enum.RenderPriority.Camera.Value + 1, function()
		local mouseDelta = userInputService:GetMouseDelta()
		if mouseDelta.X > 5 then
			Rot = Rot:Lerp(CFrame.Angles(0,0, math.rad(15)), 1)
			camera.CFrame *= Rot
			print('turn right')
		elseif mouseDelta.X < -30 then
			Rot = Rot:Lerp(CFrame.Angles(0,0, math.rad(-15)), 1)
			camera.CFrame *= Rot
			print('turn left')
		end
	end)

For reference:

robloxapp-20231102-2222400