Help With Part Touched Event

Hello I was trying to make a pickaxe print something when the part is touching another part but only when the tool is activated, but it only prints when the part is equipped and not activated.

here is some code that I wrote:

:slight_smile:

3 Likes

You could just use Tool.Equipped.

1 Like
Pickaxe.Activated:Connect(function()
if not debounce then
debounce = true
PlayAnim()
local touchConnection
touchConnection = Blade.Touched:Connect(function(otherPart)
otherPart = wall
print(Blade.Name.." has touched"..otherPart.Name)
end)
wait(DT)
touchConnection:Disconnect()
debounce = false
end
end)
2 Likes

can you explain a little more because I did use Too.Equipped. but that did not work, unless I did it wrong.

1 Like

it works well but it counts it more than 1 time. I will try to fix it.

1 Like

Add a debounce with a cooldown in the function touchConnection

2 Likes