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:
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:
You could just use Tool.Equipped
.
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)
can you explain a little more because I did use Too.Equipped. but that did not work, unless I did it wrong.
it works well but it counts it more than 1 time. I will try to fix it.
Add a debounce with a cooldown in the function touchConnection