Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to Make A Function Run On Changed Properties?

Asked by 5 years ago

What is the generic format to get a function to run only when a certain object's property is changed? This would be extremely useful to me if it even exists. For instance, what it I wanted a sound to play every time a brick changed color? Thanks so much in advance.

1 answer

Log in to vote
0
Answered by
BenSBk 781 Moderation Voter
5 years ago

You can use Instance:GetPropertyChangedSignal for the required functionality:

part:GetPropertyChangedSignal("Color"):Connect(function()
    sound:Play()
end)
Ad

Answer this question