Turn ReplicatedStorage Values to "Attributes"

  1. What do you want to achieve?

I want turn the values I have in ReplicatedStorage to Attributes.

  1. What is the issue?

G’day! Roblox just released the feature called “Attributes”. In my opinion, this sounds like an amazing idea to replace bool values, string values, etc.

However, I think there’s a lack explanation about how they are supposed to work, which got me stuck on this question. How can I convert my current values (BoolValues, stringvalues, etc) to Attributes I have not idea how to convert my current values on ReplicatedStorage to Attributes.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I have spent like hours trying to analyze how It is supposed to work, however I got nothing but a headache.

I’m not asking about a full script or something, I just need ideas.

What exactly are you trying to accomplish with Attribute.

From the sound of it, attribute is meant to give additional static information to an object.

If you want more information about attributes. It can be found here.

Well, I haven’t used attributes much yet since they just released and I promised myself not to get used to them until they did :wink: but the general concept of attributes is that you can store and get pieces of information by using Instance:SetAttribute("Name", Value) and Instance:GetAttribute("Name")

Assuming not all children of the object in question are values, you would need to check and make sure they are some form of value. You can check each class name or you can be a little hacky and search the class name for the word “value” so it picks up things like “objectvalue” and “stringvalue” without you needing to manually account for each of those.

If you wanted to convert all the value objects of a part to an attribute you could essentially do this: (I am on mobile so this is not meant to be fully working code)

local part = some part

for i, child in pairs(part:GetChildren()) do
    if (string.find(child.ClassName, "Value")) then
        part:SetAttribute(child.Name, child.Value);
    end
end

Be aware with this solution you could end up overwriting attributes of any of the values have the same name.

VERY IMPORTANT: Not all value types are able to be attributes yet! Please be aware values like object values will not work

Use this plugin by @RealExoctic ValueToAttribute - Convert your value objects to attributes easily

Basically, turn the values I have on ReplicatedStorage to Attributes values. These “Values” on the ReplicatedStorage helps to my GUI’S to become visible, invisible, overwrite text, etc.

My GUI’s depends so much of them.