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

What function can i use to detect if model have child added OR child removed?

Asked by 3 years ago

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?

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

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

0
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... Gulgazar 65 — 3y
Ad

Answer this question