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

Changing just the Y orientation out of x,y,z?

So I'm writing a script involving the changing of the Orientation property/ The problem is it's multiple parts, all with different Z orientations that I don't want to mess with - I only want to change the Y. Can I change just the y part of the property without interfering with x and z? If so, how?

Thanks.

2 answers

✓ Accepted answer

In order to change only one axis of rotation without affecting the other axes, you can add the original vector with a new one. For example, the following would increase only the y axis of the vector by five:

local vector = part.Orientation
vector = vector + Vector3.new(0 , 5 , 0)
part.Orientation = vector

Adding vectors is just adding the individual components of the vector operands. For example, Vector3.new(1,2,3) + Vector3.new(4,5,6) would equal Vector3.new(1+4 , 2+5 , 6+3).

1 comment

0

Thank you so much!!

just type .y after the thing...

example:

part.position.Orientation.y = #

1 comment

0

The y property of Vector3 is read only.

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