I am curious how to say if just one orientation axis is a certain number. do you use underscores for the other axises?
✓ ANSWER ACCEPTED
How to refer to just one orientation axis. ???
1 answer
✓ Accepted answer
function onClicked()
if script.Parent.Union.Orientation.Z == 2 then
print('Hello World!')
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
Orientation is a Vector3 value, so it has X,Y,Z,Magnitude, and unit (not sure about unit) using == 2 will not work if Orientation.Z == 2.1 so you can round the rotation before
local function round(val)
return math.floor(val+0.5)
end
function onClicked()
if round(script.Parent.Union.Orientation.Z) == 2 then
print('Hello World!')
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
3 comments
0
thx adasgadfg!
0
ok, one more question, is there a way to SET just the z axis orientation?
0
part.Orientation = Vector3.new(part.Orientation.X,Part.Orientation.Y,2)
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
function onClicked() if script.Parent.Union.Orientation == 0,0,2 then print("hello world") end end script.Parent.ClickDetector.MouseClick:connect(onClicked)
could the 0s be replaced with something, or is there a way to just reference one asix?