Add Instance as a Valid Attribute Type

As a Roblox developer, it is currently inconvenient when making Attribute-based systems to suddenly need an ObjectValue instance because “Instance is not a supported Attribute type”.

If this issue is addressed, it would improve my development experience because I wouldn’t need to change how I receive values, going from property-like instance Attributes to relying on ValueBase instances. For example, when keeping track of the last player to attack an NPC, that information could be kept as an easily overwritable Attribute of the NPC rather than relying on physical values within said NPC.

While Attributes were, to my understanding, not a replacement for ValueBase instances, it has greatly increased my workflow to be able to give instances characteristics without creating further instances. Some instances already have Instance-type properties, so I would be willing to assume that this might be something easy to implement on the Roblox backend.

48 Likes

I’ve mentioned this on the original thread a̶n̶d̶ ̶i̶t̶ ̶s̶t̶i̶l̶l̶ ̶h̶a̶s̶n̶’̶t̶ ̶b̶e̶e̶n̶ ̶a̶d̶d̶e̶d̶:


I’m quite surprised that they didn’t add all of the different object types as valid attributes.

6 Likes

Its to do with serialisation, afaik, ObjectValues don’t keep their value when saved.

Ok, yes, you could probably have it at runtime, but Roblox wants to keep attributes standardised which would mean changing something major to the binary format.

Kind of weird because the format DOES have a unique ID for each instance which would make it possible,

7 Likes

Attributes also have support for tables, dictionaries, and a ton of other data types, that behaviour is just disabled initially:

I think it’d be very nice to have Instance types on attributes, and with other stuff, that’d basically allow me to actually port all of my game classes to fully utilize attributes.

@metatablecatgirl ObjectValues do store their values just fine. They use a referent which is basically just an ID specific to the rbxm file its part of that tells it what instance in the file to refer to. You can save an ObjectValue with its value so long as the instance it references is part of the same file (otherwise you couldn’t save ObjectValues in your game at all, their value would reset at runtime)

Making attributes support instances is as simple as using the referent ID in the file.

5 Likes

I figured something like this might be the case. I also understand their approach to implement this as a system that is freely accessible without programming but CFrames, for example, one of the most commonly used data types, are not visible in property menus. I think all types should be available for use in the meantime.

1 Like

Object attributes are extremely important for things like streaming!

ObjectValues currently handle parts streaming in/out very seamlessly, which makes them easy to work with. It’d defnitely be nice to support object attribute types with this behavior as well.

6 Likes