This function returns an event that behaves exactly like the
Changed event, except that the event only fires when the given attribute changes. It’s generally a good idea to use this method instead of a connection to Changed with a function that checks the attribute name. Subsequent calls to this method on the same object with the same attribute name return the same event.
It is similar to
Instance/GetPropertyChangedSignal but for attributes.
For example, the following code snippet will return a signal that fires the function
attributeChanged when the instance’s
InitialPosition attribute changes. Note that this code sample does not define
local function attributeChanged() print(“Attribute changed”) end instance:GetAttributeChangedSignal("InitialPosition"):Connect(attributeChanged)
Attributes are serialized when an instance is saved to a file. This means that they will persist between studio sessions and can be assigned a value before a place is running.
Attributes are replicated, respecting filtering rules, from server to client. If the server changes an attribute, the clients value will also change. If the client changes the value however, it will not be changed on the server.
- Basic Lua primitives: string, number, bool, nil
- Roblox atomic types: Vector3, UDim2, NumberSequence, etc…
- Advanced types: Instance reference, table.
Instance/SetAttribute, sets the attribute with the given name to the given value
Instance/GetAttribute, returns the attribute which has been assigned to the given name
Instance/GetAttributes, returns a dictionary of string → variant pairs for each of the instance’s attributes
Instance/AttributeChanged, fires whenever an attribute is changed on the instance
The name of the specified attribute for which the change signal is being returned
An event that fires when the given attribute changes