Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I change a part's Y-axis rotation?

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.

1 answer

✓ Accepted answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.