I have two CFrames, x and y. I want to take the Z rotation from y and rotate x by it

I've tried doing

local px, py, pz,
xx, xy, xz,
yx, yy, yz,
_, _, _ = x:components()

local _, _, _,
_, _, _,
_, _, _,
zx, zy, zz = y:components()

local newCf = CFrame.new(px, py, pz, xx, xy, xz, yx, yy, yz, zx, zy, zz)

But that doesn't give the desired result

Heres a gif of the problem I'm trying to fix

I'm trying to match the rotation of the arm to the gun handle rotation