Hello. I’m trying to make a working door that checks if it is at a certain orientation and progress. But it errored. Could you guys help me?
Here’s my code:
local door = script.Parent
local doorHandle = door.DoorHandle
local clickHandle = doorHandle.ClickHandle
local function onClicked()
if door.InnerDoor.Orientation == door.InnerDoor(0, 90, 0) then
print("Should return")
else
print("Should rotate 15 degrees and move.")
end
end
game.Workspace.Door.DoorHandle.ClickHandle.MouseClick:Connect(onClicked)
Your issue is probably that you are attempting to compare a InnerDoor’s orientation to a value that is not a member of InnerDoor. In this case, you should use a Vector3 value to compare to InnerDoor’s orientation.
local door = script.Parent
local doorHandle = door.DoorHandle
local clickHandle = doorHandle.ClickHandle
local function onClicked()
if door.InnerDoor.Orientation == Vector3.new(0, 90, 0) then
print("Should return")
else
print("Should rotate 15 degrees and move.")
end
end
game.Workspace.Door.DoorHandle.ClickHandle.MouseClick:Connect(onClicked)