How to make door open and close both ways?

I have a basic door that opens and closes but I want it to open away from the player depending on what side of the door the player is on. Like in Half Life 2.

I figure I need to get the player transform.forward and give that info to the door script but I’m not sure the best way to do that.

Passing the player’s world position into the door’s InverseTransformPoint will give you the position of the player in the door’s local space. From there you can check the x or z axis of that vector is negative to determine which side of the door the player is on. Whether you’ll check z or x depends how you’ve set up the door.