PcoWSkbVqDnWTu_dm2ix
The Developer Hub is now deprecated and information on this page may no longer be accurate. To see our new and improved documentation, please click here. You can read more about the future of documentation here.
Collapse Sidebar

GetPropertyChangedSignal

This method returns an event that behaves exactly like the Changed event, except that the event only fires when the given property changes. It’s generally a good idea to use this method instead of a connection to Changed with a function that checks the property name. Subsequent calls to this method on the same object with the same property name return the same event.

print(object:GetPropertyChangedSignal("Name") == object:GetPropertyChangedSignal("Name")) --> always true

ValueBase objects, such as IntValue and StringValue, use a modified Changed event that fires with the contents of the Value property. As such, this method provides a way to detect changes in other properties of those objects. For example, to detect changes in the Name property of an IntValue, use IntValue:GetPropertyChangedSignal("Name"):Connect(someFunc) since the Changed event of IntValue objects only detect changes on the Value property.

Parameters

Name Type Default Description

The property to connect to.

Returns

Return Type Summary

A signal that fires whenever the property changes.


Code Samples


Old-to-New Values with Changed

This code sample demonstrates how to save a value before a changed event fires on it in order to get more information about a change.


Changed and GetPropertyChangedSignal

This code sample demonstrates the equivalence of the Changed event and event returned by GetPropertyChangedSignal.