Tutorial: One-Way Door

A presentation about solutions to creating a day and night cycle in Roblox
Like with all my tutorials, a video guide is available at https://www.youtube.com/@aargon1475

Alternative Solutions

One way to go about the one way door is to use the Instance.Touched and Instance.TouchEnded events: register the player in a table with his character instance on the touched event, and unregister his instance on the touch-ended event (to act as a per-player debounce); then, on touched event, check if the player is relatively behind or in front of the part by observing the z-coordinate of the relative c-frame of the player to the door, obtainaed with character.CFrame:ToObjectSpace(door.CFrame).
Unfortunately, Instance.Touched will not fire on a direct c-frame update, only through the physics system, so teleporting through the door or tweening the player's c-frame will not trigger going through the door one-way. The most robust method is to use RunService.RenderStepped locally to determine if the player went through the door, and from which direction.

The One-Way Door

This one-way door can only be triggered from one side. Once triggered, it runs the "OnTriggered" function, that we define, to perform some task, e.g., blocking the player off, or, in this case, teleporting the player.