Adding Attribute values with Code

Hello, I am wondering if it’s possible to add Attribute Values with a script.
If it’s possible please let me know how it’s done.

I am wondering if this is possible so I can improve my data saving/loading systems to not use several values.
Thank you, Zonix.

Yes, it’s possible:

local weapon = script.Parent
 
-- Create an attribute
weapon:SetAttribute("ReloadTime", 3)

Keep in mind that using this function (method) and passing an already existing attribute will modify the existing one instead of creating a new one.

Some more information if you need it: Instance Attributes | Documentation - Roblox Creator Hub

4 Likes