Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

How can you remove a block when a StarterGear item is on and when you click on it?

Asked by
mymw 5
9 years ago

The title says it all.

1 answer

Log in to vote
0
Answered by 9 years ago
local tool = script.Parent -- Make sure the parent is a HopperBin inside of StarterGear
tool.Selected:connect(function(mouse) -- When the tool is selected...
    mouse.Button1Down:connect(function()-- When the mouse is clicked...
        if mouse.Target ~= nil and mouse.Target.Name == "Part" then -- [[Change the Part to whatever the name of the object is, this makes sure that the part that the mouse is clicking isn't a random part that is crucial.]]
            mouse.Target:remove()-- Remove the object
    end)
end)

Hope i helped!

Ad

Answer this question