Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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

1 comment

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...

This discussion is preserved as it was. New answers, comments, and votes are closed.