Moving the player's torso with a locked camera

i have been trying to make the player’s torso follow the camera precisely when looking up and down. i have a script that works, but since the camera is locked in place ( like shift lock) the torso doesn’t move very accurately to the camera, and since i’m making a thord person shooter, its very important the torso 's movement stays centered with the camera.
here is the code i’m using currently

local cam = workspace.CurrentCamera

local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local hrp = char:WaitForChild("HumanoidRootPart")
local upperTorso = char:WaitForChild("UpperTorso")

local waist = upperTorso:FindFirstChild("Waist", true)
local z = waist.C0.Z
local waistC0 = waist.C0

local remoteEvent = game:GetService("ReplicatedStorage"):FindFirstChild("TorsoToCamera")
local remoteEvent2 = game:GetService("ReplicatedStorage"):FindFirstChild("EquipLaser")

remoteEvent2.OnClientEvent:Connect(function()
	game:GetService("RunService").PreAnimation:Connect(function()
		if _G.modeSwitchAnim == false  and _G.laserActive == true then
			if waist then
				camDirection = hrp.CFrame:ToObjectSpace(cam.CFrame).LookVector				
				remoteEvent:FireServer(waist, z, camDirection, _G.laserActive)
				waist.C0 = waist.C0:Lerp((CFrame.new(0,0,waist.C0.Z) * CFrame.Angles(0,0,(camDirection.Y*-1))), 1)

			end
			
		elseif _G.laserActive == false then
			if waist then				
				waist.C0 = CFrame.new(0,0,0)
				remoteEvent:FireServer(waist, z, camDirection, _G.laserActive)
			end
		end
	end)
end)

i’m using a modified script i found here on devforum

here is a video of the problem:

as you can see, when i look too far up or down, the torso (and the weapon) just decenter from the camera. any ideas on how i can solve this? i looked all over the devforum. thanks in advance =D