if script.Parent.Parent.Parent == game.Workspace then
debounce2 = false
else
debounce2 = true
script.Parent.Equipped:Connect(function(m)
local debounce2 = false
local plr = script.Parent.Parent
local debounce = false
if not debounce or debounce2 then
debounce2 = true
debounce = true
plr.Humanoid.Touched:Connect(function()
script.Parent.Sound:Play()
wait(.1)
return
end)
end
end)
script.Parent.Unequipped:Connect(function(m)
local debounce2 = true
local debounce = true
end)
end
It’s a script that allows for the player’s body parts to make a tapping sound whenever the tool is activated
if script.Parent.Parent.Parent == game.Workspace then
debounce2 = false
else
debounce2 = true
local humTouchConnection -- so unequip function can access
script.Parent.Equipped:Connect(function(m)
local debounce2 = false
local plr = script.Parent.Parent
local debounce = false
if not debounce or debounce2 then
debounce2 = true
debounce = true
humTouchConnection = plr.Humanoid.Touched:Connect(function()
-- set connection
script.Parent.Sound:Play()
wait(.1)
return
end)
end
end)
script.Parent.Unequipped:Connect(function(m)
-- disconnect
if humTouchConnection ~= nil then
humTouchConnection:Disconnect()
end
local debounce2 = true
local debounce = true
end)
end