My door isn't working properly

Hi, i have a problem with the door I made, i think this is with the orientation thing if someone could help me, I did it on only 1 axis (X)


^ that is how it should normally work
but when I rotate it it does this


image
and this is the problem

this is the line of code that the animation is in

I think I have to multiply the position with the orientation
so it works in any orientation

3 Likes

You’re only changing the Position property of the door, not the Orientation property. Try something like this instead.

{Orientation = v2.Doors.Left.Orientation - Vector3.new(90, 0, 0)}

You’ll probably need to change the values/axis the rotation is performed along to match your needs but this will rotate the door 90 degrees clockwise along the X axis.

1 Like

You didn’t understand, I don’t want to change the Orientation, I was saying to multiply the Vector3 with the orientation and maybe that will work, I’m not rotating the door, I’m moving it.

If it’s moving along the wrong axis then try Z instead.

The thing is, this is not a script for a specific door, I did a for loop for every door and did that on general, I cannot say that.

Could you get the orientation of each door and then determine if it should be moved along the X or Z axis that way?

That’s what I was asking, how do I make it to move on any axis to the left/right.

Okay, I understand now, apologies for reading between the lines.

You basically want to refer to the object using its object space as opposed to its world space.

1 Like

I think so, if you could help me get it to work becuase I’m not that good at it.

Like, I’m a bit confused on how to do it.

Tween the CFrame instead:

local r = math.rad 

local pos = Vector3.new(0, 0, 0)
local rot = Vector3.new(0, 0, 0)

--we have to convert degrees to rads for CFrame.Angles
local cf = CFrame.new(pos) * CFrame.Angles(r(rot.X), r(rot.Y), r(rot.Z))