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

How to detect a part being deleted?

Asked by 10 years ago

I now of if part == nil then but I have multiple parts that are the same name. I need it to trigger a function every time one is removed. Is there a method?

1 answer

Log in to vote
2
Answered by 10 years ago

Yeah, there is an even for that:

part.Parent.ChildRemoved:connect(function(child)
--Child is the part that got removed
end)

Now, it doesn't need to be exactly part.Parent, it's just the model that contains those parts.

0
I would add an if statement checking if the child removed was the same part as "part" soaprocks2 75 — 10y
Ad

Answer this question