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

How to refer to just one orientation axis. ???

I am curious how to say if just one orientation axis is a certain number. do you use underscores for the other axises?

2 comments

0

function onClicked() if script.Parent.Union.Orientation == 0,0,2 then print("hello world") end end script.Parent.ClickDetector.MouseClick:connect(onClicked)

0

could the 0s be replaced with something, or is there a way to just reference one asix?

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.