I have been always wanting this feature!
I have an idea how to fix that. Maybe you could do this:
local myAttribute = instance.Attributes.MyAttribute
It would be a lot more convenient if you did it like this instead of not having it at all.
I find it very cool, but I only (actually) one question:
What is the string limitation? I mean, StringValues have a “max string limitation”, and what about Attributes that hold strings? Now lets say that I am using attributes to save a mesh that have over 500 string lines, do attributes will save all the lines or only certains?
I have a suggestion. Add a “table” type. For a practical example, It could be used for something like NPC dialogue. Add a table attribute to your NPC model, and then use a for loop to make the character say the text stored in the table.(Obviously more too it than that, but you get the idea)
This also reminds me of another thing I really wanted to be added, unrelated to attributes. I think it’d be cool you you could just insert a “TableValue” instance, similar to the other values(IntValue, StringValue, etc).
While this does address the compatibility concern, it does not address the mutability concern.
Lua imposes a limit on the maximum string length, this will be the same for attributes.
As a few have stated, it would be awesome to have an Instance attribute type. I know that’s probably tricky considering instances could be streaming in & out of some games. But being able to point to other instances is really powerful.
Woah this will really help in a lot of things!
I think an important addition to make is the ability to customize the tooltip that displays when you hover over the attribute name. Considering there is no official wiki for user-defined attributes (for obvious reasons), the ability to set tooltips would be instrumental for both long-term maintenance and team create sessions alike.
I feel like this feature could use an “object” value as well for us to make use of a “serializeableField” property for those as to call it in Unity C# way. This allows us to basically drag and drop or even select an object to instantly reference to it rather than typing it out as a variable.
This would also make stuff a million times easier for artists that work in studio, rather than explaining them how you can reference to objects in a script or needing to adjust values in that script just allowing them to instantly select it in the inspector and basically removing the requirement for them to touch the scripts or for us programmers to hard code that each time we need to reference to objects or modify it.
Here’s an example for how Unity approaches this. (with dragging and dropping the object into the field)
Obviously in roblox it would be by selecting the object value as target however using the same method as the functionality as an ObjectValue implemented in this. (click the value to select an object or create a drag and drop functionality for it)
Usecases are the same as ObjectValues. easier access regardless of the object’s parent. This is simply for convenience for both developers and artists/gameplay designers.
Note:
I do not mean to exactly implement serializablefields, just to add objectvalues to the list of selectable value types in the attributes list
I think this would remove the need for value objects quite a bit. Also allows people who use models to modify with ease, like a gun for example; instead of having to go inside the model to modify the bullets, clips and such, you can simply modify those from the model by just clicking the model, and configuring it’s bullets and clips there. I am going to be very thrilled to see this getting used in live games. Imagine creating Flood Escape 2 maps, but now instead of having a lot of value objects, you can simply click a object that holds attributes, like CreatorName, MapName, Difficulty, etc.
Notably, the way to get the attributes’ values with scripts is little too much in my opinion, but thats just my opinion. It would be good if we can just get values and also change them just like with normal properties:
script.MyAttribute = 25 -- Simply sets the attribute.
script.Parent.Text = script.MyAttribute -- Gets the attribute as well.
In the end, the attribute system is a great system that I am looking forward to using a lot.
I don’t expect this to change. Otherwise it would break a lot of games. They had no choice but to add a function to specifically fetch an Attribute as to not get it confused with a property or child.
I don’t think that would be the case. I’m sure if they had instead done it that way they would alert us ahead of time like they’re doing with the pivot point update.
I am here to cast my vote for the addition of CFrame as a value type
Example: saving the “SnapToGrid” origin point for a localized area, such that I can align a model with a pre-defined grid depending on what instance or group of instances the mouse is currently pointed at
for now I, instead, will probably be doing something janky like using the Vector3 Position and LookVector and then creating the CFrame using CFrame.lookAt()
Please make it
instance.FlingSpeed = math.huge
instead of Instead of
instance:SetAttribute("FlingSpeed", math.huge)
because its not like we are naming a attribute “Name”
is this what the “GetAttribute” was for? I kept seeing it for a while while getting children
I didn’t look at this feature before but this seems super useful!
I noticed that on a lot of objects I can now add custom properties so I don’t have to insert number/int/bool/cframe values into everything.
it also seems to be ultra useful for custom inventory systems, could use something like a folder or a object that already has very little properties and then just use attributes to store JSON strings into for each inventory slot, easily add/delete them, I’m loving this.
I agree on this one, I often use lowercase names for attributes so they will never conflict with existing Roblox default properties/attributes.
Gets down on knees to pray to overlord builderman
No, really, this is SICK! Can’t wait to use this!
Scripting go