I have already tried this script with no success.
-- I put this script as a child of a Part called Part. local Block = game.Workspace.Part function DestroyBlock () Part:Destroy() end Block.ClickDetector.MouseClick:Connect(DestroyBlock())
If you could help, I would be very happy.
workspace.Part.ClickDetector.MouseClick:Connect(function() script.Parent:Destroy() end)
This should work considering you placed the script inside a part.
~Dan_PanMan, advanced scripter.
Hello, admin4lifenow!
Test out this script instead. I don't see an error in your script, but I hope that this ones works for you:
Put this script inside of the ClickDetector
script.Parent.MouseButton1Click:Connect(function() script.Parent.Parent:Destroy() end)
``local Block = script.Parent
Block.ClickDetector.MouseClick:Connect(function() Block:Destroy() end) ``
Make sure you have a Clickdetector in your part so u can click it! also use script.parent instead of game.workspace in case you move the part it will still work.
Hi!
This should be able to work:
local cd = Instance.new("ClickDetector",script.Parent) cd.MouseClick:Connect(function() script.Parent:Destroy() end)
Make sure that this script is inside the part that you want to be destroyed.