Trigger Event on Attribute Addition

Is there a way to detect when a new attribute is added to an object using the SetAttribute() method?

I want to track all attributes on an object, including any new ones added dynamically. Does Roblox provide an event or mechanism to achieve this?

1 Like

Use AttributeChanged, keep in mind that this will also detect when an attributes value changes.

Thats exactly what I want [checking for both]. How would I write it?

2 Likes

I ran this as a test so just replace workspace with your instance.

workspace.AttributeChanged:Once(function(attr) print(attr) end) 
workspace:SetAttribute("test", 3)
instance.AttributeChanged:Connect(function(attrName) 
    print(attrName.." added or changed.")
end)
1 Like

Thanks Friend. It works we6terll.fefwefwefwe

2 Likes