I need to detect both situations - child added and removed - in one connection. What function can be used for that? If "Changed", then what parameter?
COMMUNITY QUESTION
What function can i use to detect if model have child added OR child removed?
1 answer
You can use the events Instance.ChildAdded:Connect() and Instance.ChildRemoved. Not sure what you mean by "in one connection" though, if you were talking about the function not having to run every second, Events only fire the function once the said event happens.
YourInstance.ChildAdded:Connect(function(theNewChild)
--Code
end)
Reference: https://developer.roblox.com/en-us/api-reference/class/Instance
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Sure, i know about ChildAdded/ChildRemoved, i just wanted it in some other way, to put it in one connection instead of two. For example something with AncestryChanged, idk...