Although it may not be the most needed listener, I’d really like to see it added. Right now I am working on a plugin that produces a changelog and I don’t want to be connecting changed to 10,000 instances, when instead I could be connecting to just one. Not to mention I am sure other users would be able to make use of this to make sure if they are not using filtering enabled that their game is not being tampered with.
Furthermore, it’d be great to get a second argument for both this and changed which would pretty much be the client or server that made the change.
I’ve not got much time, hence the kind of sketchy outline, so I hope I’ve explained adequately enough.
Not sure it’s worth the engine having to watch for so many changes. Why not make a single recursive function and hook up changed events to all the objects? Then use DescendantsAdded/Removed to add/remove events as needed?
Well, in the end you still have to connect all the events. So if you want to keep track of what object is being changed, you’re still going to have a lot of functions to feed into one major one. One example:
function DescendantChanged(obj, prop)
-- Foo
end
-- Initial scan to draw in all descendants:
local function Scan(parent)
for _,v in pairs(parent:GetChildren()) do
v.Changed:connect(function(prop)
DescendantChanged(v, prop)
end)
Scan(v)
end
end
Scan(ancestor)
ancestor.DescendantAdded:connect(function(descendant)
descendant.Changed:connect(function(prop)
DescendantChanged(descendant, prop)
end)
end)