I have a Tool that has a Script in it. That script requires a ModuleScript in ReplicatedStorage that creates a prototype for it. When the Tool gets deleted, the prototype should too.
So that’s what I’ve done. I connected AncestryChanged to the Tool, and if the 2nd argument (which I like to call parento
) is nil, it’s been deleted.
Except it doesn’t work. When the script is deleted, the connection doesn’t fire, even though it’s in a different script. I’ve tried making the connection in a different coroutine, in an object method via metatables, it just doesn’t matter.
Likewise, ChildRemoved doesn’t work either.
It seems like it’s impossible, but maybe it isn’t. What do you guys think?
The design requirements for this implementation are:
- the connection must be handled in the ModuleScript
- no additional scripts may be added
Here is a place showcasing the behavior:
AncestryChanged Issues.rbxl (13.6 KB)
When the place is run, it is expected to see this in the output:
Part nil
Model nil
but only Part nil appears.