Viewmodel sway behaving not how I want it

I’m trying to create an fps system similar to that of Deadline’s, but it’s like the sway’s rotation is localized and it looks really strange. I have tried many things, but they didn’t work. I don’t even really know where the issue is, but I think it might have something to do with one of or the two variables dealing with rotation calculation. The function is ran on the RenderStepped function.

Code:

local function swayUpd()
	vm.CameraBone.CFrame = cam.CFrame
	local rot = cam.CFrame:ToObjectSpace(camCF)
	local x,y,z = rot:ToEulerAngles()
	print(math.round(x), math.round(y))
	local max = 0.4
	local xv = math.clamp(x, -max, max)
	local yv = math.clamp(y, -max, max)
	sway = sway:Lerp(CFrame.Angles(-math.sin(xv)*mX, -math.sin(yv)*mY, 0), 0.1)
	
	vm.CameraBone.CFrame = vm.CameraBone.CFrame * sway
end

Vid: