Direction based on orientation

i want to move an object based on orientation
for example if an object orientation is 0, 180, 0 or 0,-180,0 i can just change the z and if it is 0,90,0 then i can just change the x
but i dont know what to do if it the orientation was something like 0,62,0

you can use lookvector for this

Part.CFrame += Part.CFrame.LookVector * 5 --// 5 is the distance to move the part.

it doesnt work or go the way it is supposed to

are you sure that the orientation is right or maybe youre trying to move the part to the side which in that case you would do:

Part.CFrame += Part.CFrame.LookVector * Vector3.new(5, 0, 0) --// or negative number if you want the part go left.

well the objects orientation is -180 and i want it to move they way that makes the z smaller(go more negative like -15 to -20)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.