Cannot change Orientation.Y value

I have this code

Part.Orientation.Y = theta2

And when I press play I get an error saying “Y cannot be assigned to”
theta2 is NOT nil
Part is NOT nil
Please help.

1 Like

Have you tried to use vector3?
Part.Orientation =, theta2, 0)

1 Like

Try using the CFrame.Angles() method.

local angle = CFrame.Angles(0, math.rad(90), 0)
local cframe = part.CFrame *= angle

See here for more info:

Wait I just realized the problem: It wasn’t allowing my to change the Y value because of the rotation of the part, so I just set it to change the X value and it got fixed.

Oh ok, it was easier than I thought

We’re you in a rush? Because this is impossible.

1 Like

What do you mean by “impossible”? That you can’t do that?

Wait, I’m an idiot I see what you mean… LOL

1 Like
Part.Orientation =,theta2,Part.Orientation.Z)

You can’t assign values to the components of a Vector3 value which describe a BasePart’s position/orientation, you need to construct a Vector3 value instead and assign that directly to the BasePart’s position/orientation property.

Is the correct solution.