When to use Values and Attributes?

Im making a game, and most of the current systems are OOP based. But I heard in a video once that I should also sometimes use Value Instances (IntValue, StringValue, BoolValue, etc.) / Attributes.

But I find it hard to find use cases for these, wouldn’t it just be better to have those values as variables in a script? What if I want to make a movement system with a stamina value? Are there any advantages? Why do you think someone would use Value Instances / Attributes over just plain simple Variables or Tables?

2 Likes

Hello!

From what I’ve experienced, attributes are sort of like a replacement I’d say when it comes to storing data. They’re so much easier to use, and especially if you’re working on a commission and the person on the receiving end doesn’t know how to use the code editor on roblox attributes could make it very easy.

Also you could easily use the :GetAttribute method to communicate variables between scripts (server or client sided) without the usage of Bindable or Remote events.

image

tl;dr - attributes make it easier to edit & adjust values and make things way cleaner + if ur selling ur product it makes it easy for someone who isn’t that familiar with roblox studio’s code editor to quickly edit a few variables + u dont need events to communicate stuff