Add Instance as a Valid Attribute Type

It’s been 3 years, why isn’t this added yet? UniqueIds are already internally built in, how hard could it be to add this?

3 Likes

it has nothing to do with unique IDs, but it really comes down to the design implementation that may be confusing. things like value objects have existed for years now, but due to the nature of an ‘attribute being non-existent if nil’, the design of value objects will not suffice

1 Like

UniqueIds aren’t new, they’ve always existed in the engine, Roblox has only recently surfaced them to the developer.

The issue is that Roblox wants a way to make it so you can edit the attribute in the properties window, but the default state of an Instance value is nil.

Attributes assume nil = nothing, so it will disappear from the properties window if you clear it, which might be unusual to developers.

1 Like

I could see some ways to implement it with that in mind:

  1. Scripting/command bar needed to create the attribute, like with Enums.

  2. Created Instance attributes defaults to the instance containing it, like how numbers default to 0 or strings start empty.

  3. Creating an Instance attribute also has the functionality of clicking the field. You must select an instance or remove the attribute.

  4. Studio keeps track of which attributes are defined in a hidden temporary list that is not saved.

I also think an Instance attribute could be left empty if the instance containing it were a package that previously had the attribute set.