I want to be able to check if a tool has been destroyed with a script that is inside the tool but it never fires. I have tried to use both server and client scripts but they don’t work. It only works if a script is parented out of the tool. Is there a way of making this work?
local tool = script.Parent
tool.Destroying:Connect(function()
print("server")
end)
game.ReplicatedStorage.DestroyTool.OnServerEvent:Connect(function(player)
local character = player.Character
local tool = character:FindFirstChildWhichIsA("Tool")
if tool then
tool:Destroy()
end
end)
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
character.ChildAdded:Connect(function(child)
if child:IsA("Tool") then
child.Destroying:Connect(function()
print("test") -- only works
end)
end
end)
end)
end)
Here is the place file:
Destroying event test.rbxl (59.8 KB)