this is my script in tool. it works if i click it will 1x hit ore. i want if i hold it will repeat mining function but if i only click it will activates only 1x.
local tool = script.Parent
local swing = true
tool.Handle.Touched:Connect(function(otherPart)
if otherPart.Name == 'Rock' then
wait()
tool.Mining.Value = false
end
end)
local function mine()
if script.Parent.Damage.Value == 13 then -- this is only double dmg
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(game.Players[script.Parent.Parent.Name].UserId, 17837947) then
script.Parent.Damage.Value = 26
end
end
if swing then
swing = false
tool.Mining.Value = true
local str = Instance.new("StringValue")
str.Name = "toolanim"
str.Value = "Slash"
str.Parent = tool
wait(0.35)
swing = true
tool.Mining.Value = false
else
return
end
end
tool.Activated:Connect(mine)
