So I have a brick thats rotated on all three axes (X, Y, Z). I want to get rid of the X and Z rotations of the brick but get the Y rotation from that brick, all through a code. I noticed that if I apply this fix to a brick manually, the Y rotation ends up different than before you apply the fix. (The fix is removing the X and Z rotations.) I have tried a variety of things, but am so far coming up with nothing. I was thinking of using Euler Angles, but when I tried working with them nothing seemed to work. I never have used Euler Angles before, however, so I would appreciate any help you guys have for me if the solution does end up needing them. Thank you.
==PICS== What I want to happen: Click
What your code does (gray bricks with studs): Click
What I want the brick to end up as: Click
Red=What current version does, Green=What the brick with just Y would look like: Click

9 comments
Look at the pics I just edited into my post. The code does something weird when I use it, as shown in pic 2
What exactly are you doing to rotate it? When I test it, it gets the heading just fine.
Just creating a new part and replacing part.CFrame = CFrame.New(x, y...etc. with the new instance
What your code does to it: https://gyazo.com/78b02c9fd9305faec446c17a5693fd84
Did you set the CFrame of the new part to its own CFrame multipled by the angle? If so try this: newPart.CFrame = CFrame.new(x, y, z) * CFrame.Angles(0, ry, 0)
It flattens the brick but the Y rotation comes out incorrectly. https://gyazo.com/85dd0cdf41c63a5d36422748c0175e0e
The bricks start rotating on the 7 axis in ways that aren't even close to the original brick
Sorry about that see my edit
Thanks so much!