Skip to main content

OnAttributeChanged

Connects to changes of a specific instance attribute.

TypeSinceScoped
Connection0.0.3Yes

Constructor​

OnAttributeChanged(AttributeName : string) -> Binding

-- Embedded:
[OnAttributeChanged(AttributeName)] = () -> ()

-- Standalone:
OnAttributeChanged(AttributeName)(Instance, Callback) -> ()

Methods (Binding)​

Destroy()​

Disconnects all active connections created by this binding.

Usage​

New(MyObject, {
[OnAttributeChanged "Lemons"] = function()
print(MyObject:GetAttribute("Lemons"))
end,
})

MyObject:SetAttribute("Lemons", 5)

Equivalent to Instance:GetAttributeChangedSignal(AttributeName):Connect(Callback).