Procedural Animation C0 issues

Backround:
So basically I’m making a procedurally animated spider using a humanoid. There is a toros connected to the humanoid via a joint and I want to change the toros rotation via the C0 of the joint. However, I need the Y rotation to always be 0 so the torso is aligned on that axis with the humanoidRootPart.

Issue:
My code does (or should) keep the Y of the C0 at 0, but seemingly at certain rotations it doesn’t soo . . . idk

anyway here is codes and stuff

                local rotateToFloorCFrame = getRotationBetween(attatchment.WorldCFrame.UpVector,raycastResult.Normal,randomAxis)
                local goalCF = rotateToFloorCFrame*attatchment.WorldCFrame
                local x,y,z = goalCF:ToEulerAnglesXYZ() --The right angles in rads 
                
                
                print(math.deg(y)) --The right angles 
                
                
                goalCF =  CFrame.Angles(x,0,z) --Get rid of y
                SmallSpooder.HumanoidRootPart.Joint.C0 = goalCF.Rotation + SmallSpooder.HumanoidRootPart.Joint.C0.Position --set CFrame

This belongs into the scripting support category, change it so others can find it and solve it