Need help with custom camera system

I’m currently working on a first person camera system and I’ve been having trouble for the longest time.

Issue: I can’t look on the y-axis

For some reason I can’t look on the y-axis but I can look on the x-axis which makes zero sense even though I wrote code to implement those features (I have my camera type set to scriptable).

Below is the code for looking:

Input.InputChanged:Connect(function(InputObject)
	if InputObject.UserInputType == Enum.UserInputType.MouseMovement then
		local Delta = Vector2.new(InputObject.Delta.x / Sensitivity, InputObject.Delta.y / Sensitivity) * Smoothness

		local X = TargetAngleX - Delta.y 
		TargetAngleX = math.clamp(X, -80, 80)
		TargetAngleY = (TargetAngleY - Delta.x) % 360
	end
end)

I do however have another script that sets my cameras CFrame to the players head. I have zero clue if this overrides looking on the y-axis but I’m still able to look on the x-axis (It achieves a great effect which is why i’m doing it this way).

Below is the code for the cameras CFrame:

local runService = game:GetService("RunService")
local userInputService = game:GetService("UserInputService")
local camera = game.Workspace.CurrentCamera
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()

local head = character:WaitForChild("Head")
local humanoid = character:WaitForChild("Humanoid")

local function isPlayerMoving()
	local velocity = character.HumanoidRootPart.Velocity
	return velocity.magnitude > 1
end

local function lookOnY()
	-- a function that does nothing (it makes sense to me).
end


-- a terrible solution so I can at least look on the y-axis when not moving (not a fix).
runService.RenderStepped:Connect(function(deltaTime)
	if isPlayerMoving() then
		camera.CFrame = head.CFrame
	else
		lookOnY() -- does nothing but, it does actually allow me to be able to look on the y-axis when not moving (function is not needed for it to work though).
	end
end)

Below is video of my camera system for reference:

Is what I’m trying to do even possible? If anyone has any knowledge about cameras and how they work that would be great!

I finally figured it out, I had to make the neck follow the mouse lol