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)
25 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

9 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

5 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:

4 Likes