Tool.Destroying and Tool.AncestryChanged doesnt work?

I want to run a cleanup function whenever the tool gets destroyed (through client side) but tool.Destroying and tool.AncestryChanged do not fire at all?

I don’t have anything to show, I just have a script on the server that deletes the tool after 3 seconds, and on the client side I am just doing this:

gun.AncestryChanged:Connect(function()
    print("Ancestry changed")
end)

gun.Destroying:Connect(function()
    print("Destroying")
end)

Nothing is being printed at all when I call gun:Destroy() on the server side.

1 Like

when the server destroys it, the client doesn’t replicate those destruction events, might want to consider that. Try something like firing a RemoteEvent for this.

1 Like

Even if Destroying doesn’t fire, AncestryChanged should definitely fire. Make sure gun is actually referencing the thing you expect it to be referencing, e.g. not a clone of what’s being destroyed

local tool = Instance.new("Tool")

tool.Destroying:Connect(function()
	print("Tool destroyed.") --prints
end)

tool.AncestryChanged:Connect(function()
	print("Tool ancestry changed.") --prints twice (once when parented to workspace and once when destroyed)
end)

tool.Parent = workspace
tool:Destroy()

Those signals should fire (providing the tool is being destroyed client-side).