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

How to destroy a part only if a tool is equipped?

Asked by 1 year ago

I am trying to make a part that destroys when you click your mouse but i only want it to destroy if the tool is equipped and here is my script:

local UserInputService = game:GetService("UserInputService") local ClickTool = game.StarterPack.ClickTool local DestroyPart = game.Workspace.DestroyPart

ClickTool.Equipped:Connect(function() UserInputService.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then DestroyPart:Destroy() end end) end)

0
Use ClickTool.Activated instead of UserInputService cmgtotalyawesome 1418 — 1y
0
oh thanks iamnotcool235_s 27 — 1y

Answer this question