I have a tool which when equipped it will have a GUI pop up and once used, it will destroy the tool.
The issue that I have is that once I destroy the Tool from the server script, the client script that I have under the tool doesn’t have the Tool.Destroying event fire, which means the GUI will stay there forever. The weird thing is, I use this tool in one of my other games, and it prints just fine, but with using the tool on a plain baseplate, it does not fire (which might be because there is more stuff happening on the server on the other game, which leads to a delay in the tool actually being destroyed, allowing the event to be fired or something??)
Snippet of the local script code:
function onDestroying()
print("destroying!!!")
if currentFrisbeeChargeGUI ~= nil then
currentFrisbeeChargeGUI:Destroy()
end
end
Tool.Activated:Connect(onActivated)
Tool.Equipped:Connect(onEquipped)
Tool.Unequipped:Connect(onUnequipped)
Tool.Destroying:Connect(onDestroying)
I’ve done some research, but I cannot find a good fix for this, is there any other way to detect when the tool is being destroyed so that I can have the GUI be destroyed and not be there forever?