AutoDoors | Easily create sliding doors!

*Disclaimer: This is my first attempt at making a public module, so this is more for my own experience—but if anyone finds it useful, I'm glad!*

AutoDoors

AutoDoors is a simple module that creates sliding doors which automatically open when players approach and close when they leave. Every door you set up is tracked and can be controlled remotely via simple method calls.


🔧 Setup

  1. Place AutoDoorModule.lua into ReplicatedStorage.
  2. Create a folder named Doors under Workspace.
  3. Setup Door Models inside Workspace.Doors:
    • PivotPoint: Defines the exact CFrame to slide the door to when open.
    • Panel: The sliding door surface.

    Ensure both parts are Anchored.


🚀 Initialization


local doors = require(game.ReplicatedStorage.AutoDoorModule)

– Optional configuration overrides
doors.Config.OpenDistance = 10
doors.Config.CloseDistance = 14

– Register all doors in Workspace.Doors
doors:ScanAndInit(“Doors”)


📝 API Reference

  • doors:ScanAndInit(path) — Registers all Models under Workspace.<path> as doors.
  • doors:OpenDoor(model) — Opens a specific door Model.
  • doors:CloseDoor(model) — Closes a specific door Model.
  • doors:OpenAll() — Opens all registered doors.
  • doors:CloseAll() — Closes all registered doors.

🔔 Events

  • doors.DoorOpened:Connect(fn) — Fires with the door Model when it opens.
  • doors.DoorClosed:Connect(fn) — Fires with the door Model when it closes.

💡 Example


doors.DoorOpened:Connect(function(model)
    print(model.Name .. " opened!")
end)

✨ Extras

You can use dot‑notation to register nested folders:


doors:ScanAndInit("Map.Buildings.Doors")
Model

2 Likes

wazzup

Oh whoops sorry, should be fixed