The Engine Lacks the Ability to Add New Behavior to Instances

As a Roblox developer, it is currently too hard to create individual objects that we can assign to an instance to give it extra functionality (can be considered as DOP or Data-Oriented Programming).

Why Components?

Components can help developers organize their frameworks, and make it easier for them to understand what a specific object does. Components also allow developers to edit variables within the components during runtime that alter what the component does. This system will give developers an extra way to design their frameworks, similar to how many of them already use OOP as their framework of choice.
Popular game engines such as Unity already have this feature implemented:

A topic about this feature:

How Does it Work?

Components will work exactly like Roblox’s classes system; an ImageButton inherits from the classes: GuiButton, GuiObject, GuiBase2D, and Instance. Thus these classes add on to what the ImageButton actually does (displays an image on a frame).

The interface for inserting different components would be similar to adding attributes:

When the “Add Component” button is clicked, it will bring up a menu with the same design as the Insert Object menu but instead of every instance, it contains every component. Component names derive from the name of the ComponentScript that the component runs on.

To create a component, insert a ComponentScript into a new service: ComponentService:

--// In the ComponentScript named "Hitblox"

component = { -- "component" is a new global used specifically in component scripts
    -- This is where the component variables are stored
    Damage = 10

reference.SwordBlade.Touched:Connect(function(hit) -- "reference" is a variable of the instance that the component is attatched to
    if hit.Parent:FindFirstChild("Humanoid") then

In runtime, you can edit the component like this:

local Sword = workspace.Sword
local SwordBlade = workspace.SwordBlade

SwordBlade.Damage = 100 -- Just like how you would edit an instance's property

Why not CollectionService?

Though CollectionService allows you to assign “tags” which you can access the tagged instances and assign functions to them, it doesn’t provide a visual representation and it’s uneditable from other scripts.

If Roblox would add this feature it would improve my development workflow drastically as I’d prefer using small script chunks that I can add to my objects than full-fledged frameworks that can be hard to determine what it does and where it runs.


Not sure I exactly understand why ModuleScripts aren’t good enough? They’re perfectly fine with returning simple tables and requires are 1 line of code.

What exactly is the difference between the two?

1 Like

The link I provided explains more about components:

The difference is that you cant add a module script to an instance to add functionality to them. But adding a component gives it functionality immediately.

You should title the thread after the problem rather than the proposed solution. Someone browsing feature requests sees “Add a Components Feature” and has no idea about what problem the thread is addressing. It makes your topic harder to surface and find back via search.

ref: How to post a Feature Request