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

Event when a block changes color?

Asked by 5 years ago

Is there a way to detect when an object's BrickColor property changes? I don't want to use while loops and if statements due to increased lag. Is there an event for this?

1 answer

Log in to vote
1
Answered by
Ziffixture 6913 Moderation Voter Community Moderator
5 years ago
Edited 5 years ago

You can use the GetPropertyChangedSignal, much like Changed, it Fires when a property was changed; however, this Signal allows you to narrow itself by passing a specific Property you desire it to Fire for on alternation. Pass 'BrickColor' as the specified property, and it'll Fire the Listener accordingly

local Part = workspace.Part

Part:GetPropertyChangedSignal("BrickColor"):Connect(function()
    print(Part.Name.."'s BrickColor changed!")
end)

Hope this helps! If so, forget to accept this answer! Have a nice day,

Feahren.

0
It worked! Thanks! User#26817 0 — 5y
0
You're welcome! Ziffixture 6913 — 5y
Ad

Answer this question