I’m working on a door system where players press E to open/close doors (Basically like Flee The Facility). The doors are controlled by a Server Script with a RemoteEvent, and there’s a progress bar UI on the client showing the opening animation.
I initially tried using a BoolValue in the door model locked for server-side debounce, so multiple players could not open the door simultaneously. That approach didn’t work as intended, and the local progress bar still appears for multiple players pressing E at the same time
Server Script:
- Stored in each door model.
- Tracks the current door state (
Opened/Closed). - Handles door tweening and collision changes.
- Listens to a RemoteEvent from the client (
DoorOpen) and only operates if the door isn’t locked. - Fires a
DoorTweenFinishedevent after the tween finishes for client-side feedback.
Client Script (LocalScript):
- Listens to user input (E key).
- Finds the nearest door within 5 studs.
- Fires the server RemoteEvent (
DoorOpen) with the desired action. - Animates the GUI progress bar based on server confirmation (previous attempts just showed it immediately, which caused multiple players to see a different bar even when the door was busy).
I was hoping anyone had a solution to this issue, I would really appreciate code examples or approaches!
If you need any more info please just ask.