How do I get a parts y axis?

Whenever I rotate a part on the y axis in world space, it changes the y axis, but if I rotate the parts y axis on local space, then it changes other things like x and. How do I get/change the local y axis only?

part.CFrame *= CFrame.Angles(0, math.pi * 0.5, 0) -- y is middle

Im not sure if smth like this is what you need, but can’t you just use CFrame.Angles?

What what this line do? What I’m trying to accomplish is a bit more complicated. I’m trying to make a hovering part, and how I’m doing it is using raycasts. A raycast is shot down, and if it hits something then it makes the attachment’s(an attachment is in the part) cframe to the raycasts pos and normal. It then puts the parts position to the attachments world position plus the attachments lookvector, which puts it up. The problem I’m having is allowing the part to rotate freely on the y axis only. The other two (x and z), are forced because its the same as the attachments.

Changing a part’s Orientation can be messy and confusing sometimes, because roblox wants to avoid degrees over 180 and under -180, so it tries to fix it if you change the value. Use CFrames to change the orientation instead.

I have to use CFrame because orientation uses world space, how can I use local space for rotation?

Sorry, I don’t really understand what you mean.

You can get the part’s global y axis via part.Position.Y and it’s local y axis via
-part.CFrame.UpVector. If your just trying to change the part’s global axis then just change it’s position without tampering with it’s x and z coordinates.