How can I make the door open dependent on the way I face?

I’ve been working on the Doors for my SCPF, and I want the doors to open away from the side the character is on. This is what I have so far:

I am simply using tween, CFrame.Angles

1 Like

If you want the door to open to a different direction based on which side of it the character is, then you could get the character’s position relative to some cframe which is positioned inside the door and which’s lookvector is a normal of the door front surface and multiple the angle with the sign of the relative z.

Edit: @xZylter’s suggestion may be better.

You can use Dot Products to compare one of the door’s Unit Vectors (LookVevtor,UpVector,RightVector) to the Unit Vector between the door and the player’s position. Dot Product returns a value between 1 and -1 depending on how close two Unit Vectors are facing each other. And then you can use the sign of the value that’s returned to identify which side of the door the player is on.

If you are able show the door it would be easier to write out some code for what I’m talking about.

Thanks for the replies, I’ll try them out ASAP.