If you want to destroy a Part with a ClickDetector inside of it when its clicked, you’d want to do something like this in a Script:
-- Script
local part = workspace.Part
local clickDetector = part.ClickDetector
clickDetector.MouseClick:Connect(function()
part:Destroy()
end)
You could just parent this Script to ServerScriptService, adjust the paths as necessary, and call it a day. The ClickDetector here will also be destroyed.
However if you actually want to destroy the ClickDetector itself when its clicked for a respective Part, you’d do:
-- Script
local part = workspace.Part
local clickDetector = part.ClickDetector
clickDetector.MouseClick:Connect(function()
clickDetector:Destroy()
end)
Just make sure you aren’t parenting the Script to the ClickDetector here if you also want to do more things after the MouseClick connection. If you did, you’d also be destroying the Script itself. The Part would remain intact here.