Object Oriented Door System

Object Oriented programming in roblox, if applied correctly, can make development and organization a lot easier. But finding applications for things like OOP in roblox can be a bit difficult, and so I decided to create an example of how OOP could be applied to things like door systems in Roblox.

System Information & OOP application
This is a basic door system that uses OOP principles to handle the door attributes and methods, such as :OpenDoor() and others. Each door is assigned to a child class, which inherit from a parent class called “Door”. The parent class includes all of the attributes as well as methods, methods such as :OpenDoor() are default to the single doors (uses CFrame.Angles()). Other doors, such as gates, need to override the OpenDoor method because to open them, the doors don’t need to be rotated, but moved up (or down, can be changed as you want) using Vector3.new(). Other door classes like the double door has two hinges for each door, and so that class needs to override the default method as well. The Single Door class does not override the :OpenDoor() method.

Creating new doors
To create a new door, you will need to copy an already existing door (if you want to create a new door with a new class then see the next section) and remove the child parts in the Door folder. Then, create the door however you want it to look like, take the invisible parts (such as the hinge, PromptParts & others) and position them correctly on your new door (use older doors for reference). Once done, unanchor all of the movable parts, choose a main part out of them, and weld the others to that part. Then, go to the hinge and weld it to the part to which the other parts are welded to.

Creating a new door class
To create a new door class, copy the Example class and edit it. To override methods, you will have to copy the structure of the method (called Polymorphism btw) and paste it in your new class. This can be done with any method and attribute!

To get the system, you can either download this game here:
Object Oriented Door System - Roblox
Or download it here:
Object-Oriented-Door-System.rbxl (82.1 KB)


how do i make the doors open?

1 Like

Go near the doors and hold the proximity prompt

thats what i did, it doesnt open them

1 Like

Dude, they are literally do not open, is it an anti-advertising for object-oriented programming or what?


Try using TweenService or Hinges.

1 Like

What? I can’t do anything if you don’t give me more info, what isn’t opening, the default doors or custom ones? The guide I wrote should be clear enough but I am open for any help.