How do I rotate the players camera 45 degrees to the right or let?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to make a leaning system for an fps game I am working on and it works, but I want to make the camera rotate as well as move.

  2. What is the issue? Include screenshots / videos if possible!
    Whenever I set the camera offset, it works just fine except the fact that the rotating makes the camera spas out.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve tried to do rotate the player’s camera by multiplting the CFrame by the offset. My code is here:

repeat wait() until script.Parent:FindFirstChild("Humanoid")

local userInputService = game:GetService("UserInputService")
local camera = workspace.CurrentCamera
local leanDirection = nil
local leanInc = 3
local defaultOffset = Vector3.new(0,0,0)
local eOffset = Vector3.new(leanInc,0,0)
local qOffset = Vector3.new(-leanInc,0,0)
local defaultCameraOffset = CFrame.Angles(0,math.rad(0),0)
local eCameraOffset = CFrame.Angles(0,math.rad(45),0)
local qCameraOffset = CFrame.Angles(0,math.rad(-45),0)
local tweening = false

local function tween(object, goal)
	local tweenInfo = TweenInfo.new(0.25, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)
	game:GetService("TweenService"):Create(object, tweenInfo, goal):Play()
	tweening = true
	wait(0.25)
	tweening = false
end

local function updateCameraPOS()
	if leanDirection == nil then
		tween(script.Parent.Humanoid, {CameraOffset = defaultOffset}) 
	elseif leanDirection == "E" then
		tween(script.Parent.Humanoid, {CameraOffset = eOffset}) 
	elseif leanDirection == "Q" then
		tween(script.Parent.Humanoid, {CameraOffset = qOffset}) 
	end
end

userInputService.InputBegan:Connect(function(input, gameProcessed)
	if not gameProcessed then
		if input.KeyCode == Enum.KeyCode.E then
			leanDirection = "E"
		elseif input.KeyCode == Enum.KeyCode.Q then
			leanDirection = "Q"
		end
	end
	updateCameraPOS()
end)

userInputService.InputEnded:Connect(function(input, gameProcessed)
	if not gameProcessed then
		if input.KeyCode == Enum.KeyCode.E and leanDirection == "E" then
			leanDirection = nil
		elseif input.KeyCode == Enum.KeyCode.Q and leanDirection == "Q" then
			leanDirection = nil
		end
	end
	updateCameraPOS()
end)

game:GetService("RunService").RenderStepped:Connect(function()
	if not tweening then
		if leanDirection == nil then
			script.Parent.Humanoid.CameraOffset = defaultOffset
			camera.CFrame = camera.CFrame * defaultOffset
		elseif leanDirection == "E" then
			script.Parent.Humanoid.CameraOffset = eOffset
			camera.CFrame = camera.CFrame * qCameraOffset
		elseif leanDirection == "Q" then
			script.Parent.Humanoid.CameraOffset = qOffset
			camera.CFrame = camera.CFrame * eCameraOffset
		end
	end
end)

Thank you!