I want to set B's rotation around the Y axis to A's rotation around the Y axis.
I don't want to change anything else about B's rotation. I have a headache and can't think right now, but I figure I'll have to do something with trigonometric functions and CFrame:components() or something.
Thanks.
As it turns out, it's not terribly difficult! The code you're looking for is as follows:
part.CFrame = part.CFrame*CFrame.Angles(0, theta, 0)
As a quick reminder, CFrame.Angles(x, y, z)
generates a rotated CFrame based on the input angles. Therefore, this code sets the part's CFrame to the composition of its original CFrame and a rotated CFrame based on the input angle.