Create an “ObjectValue” attribute

As a Roblox developer, it is currently impossible to standardize attribute behavior in a script, as there is no ObjectValue attribute, as reported here:

Currently I have to create an instance:

local MyObj = Instance.new('ObjectValue')
MyObj.Name = 'MyObj"
MyObj.Parent = MyFrame
MyObj.Value = someObj

This could easily be summarized in a single line:

MyFrame:SetAttribute('MyObj', someObj)
51 Likes

Firstly, while this is a great idea I was able to get a response from a staff member regarding why it hasn’t yet been done.


Some detail on those particular cases you mentioned:

  • The big problem with Instance attributes is that we actually have to adjust the Attributes API to support them, because the default Instance… = nil, which is the same as not having an attribute at all in the existing API. We only really get one shot at how we adjust the API to support Instances and there’s disagreement over the best solution. It will happen eventually.

  • The issue for dropdown / Enums is the schema problem: Where do you store the list of potential options? If you store it on every single Instance which has the attribute, that’s a significant waste of memory, especially if the list of options is large. There are solutions to this, but again, we only really get one shot at choosing how we do it, so no solution has made it all the way to shipping yet.


Link to reply - New Font UI [Live] - Updates / Announcements - DevForum | Roblox

12 Likes

Thanks, but in practice, regardless of any justifications, the fact is that if it is currently possible to store an instance inside an ObjectValue property, it is not difficult to do the same for attributes. It’s just a matter of goodwill

10 Likes

This feature would be very useful with package configurations. Currently, using ObjectValue as a child of the package marks the package as modified. :confused:

5 Likes

Bump since this is very good addition and saves alot of time.
so its back on the radar.
just very convenient.

1 Like

huge bump, having to deal with using modules and item tables to point towards objects in-game when this could’ve already been a thing

2 Likes

Looking forward for this to be added, would be useful for my project I’m working on right now! :pray:

1 Like

Would love this to be added
yea bump

1 Like

Another bump - pleaseeeeeeeeeeeeeeeeeeee add this

I’m trying to use attributes more in my coding to utilize user-friendliness, their replication efficiency and their compatibility with Streaming Enabled. But the major flaw is not being able to set an instance as an attribute.

Same. I also struggle to think of substantial barriers to adding the feature. I may be mistaken but given that objects are already properties, such as in constraints, I think most of the work is done already.

The issue is the “initialisation state”. How do you define it on an Instance in the properties window.

The default state of the Instance property type is null, which conversely, undefines an attribute. For ObjectValue its not a problem because Value is a fixed property which handles null as expected.

Easiest solution would be to just make it scriptable only, like Enum attributes, or make it so you have to select an object on attribute creation.

The staff member said there’re different solutions they’re considering. Since he didn’t specify what the different considerations actually are, we’re left to guess. Nevertheless, clearly there are multiple solutions, the engineers just need to agree on which one to employ.

This is the main reason why I can’t use packages.

1 Like

Attributes were added 2-3 years ago and they’re still missing this feature. What a shame

1 Like