Attribute vs (Something)Value

Any main differences I should know about Attribute vs (Something)Value (e.g. StringValue)

Ofcourse, I know that one cool thing is that there is an ObjectValue, and Attributes cant link objects, but is there any sort of optimization preference?
Ive also seen that one difference is that one of them would return nil for the value and the other one for the instance itself. Is that all, is there anything else I should know?

1 Like

even though i don’t use attributes, i would say attributes are better since they look a lot cleaner to use. i don’t know the performance difference but i would have to assume attributes win

1 Like

Attributes are directly tied to an instance, and are (as I understand it, and somewhat have experienced) a fair bit more optimal when being replicated. They also do not add any bulk with instances, and are otherwise very flexible. Minus a few drawbacks.

You can even use Attributes on Value Objects.

They’re just great honestly.

4 Likes

Performantly speaking, attributes are much faster than value objects.

Source

7 Likes

The fact that attributes are serialised on an instance is a big winner in my opinion. Attributes are going to replicate with the instance they’re attached to instead of the replication being separated into another instance. They’re also a great match when you want to pair it up with other features like CollectionService; child instances are no longer a dependency, just the attribute’s existence.

3 Likes

Attributes are way better than values, you don’t have to use :Clone() or Instance.new() which makes it not use some of your memory, but one thing that I wish attributes have is a object type, similar to ObjectValue.

2 Likes

Wow, thats a really cool and fun fact

I wish I could give solution to 2 people xD
because this comment is packed with helpful information

Thanks for the comments everyone,
Very helpful!

1 Like