axelvl = 1 --Damage to ore.
allyWood = 5 --Money from ore.
resettime = .5 --Wait time for reuse.
Tool = script.Parent
ting = 0 --Debounce.
function hit()
print("hitting")
end
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
wait(1)
Tool.Enabled = true
end
function onTouched(hitt)
if ting == 0 then
ting = 1
if hitt.Parent.Name == "Ore" then
user = game.Players:findFirstChild(Tool.Parent.Name)
hitt.Parent.hit.Value = hitt.Parent.hit.Value - axelvl
script.Parent.Handle.SwingThree:Play()
if hitt.Parent.hit.Value < 1 and hitt.Parent.Timber.Value == 0 then
user.leaderstats.Frang.Value = user.leaderstats.Frang.Value + allyWood
hitt.Parent.Timber.Value = 1
script.Parent.Handle.EndSwing:Play()
wait(resettime)
else
wait(1)
end
end
ting = 0
end
end
Tool.Activated:connect(onActivated)
connection = Tool.Blade.Touched:connect(onTouched)
COMMUNITY QUESTION
How to change connect so instead of touching an object, you have to left click then touch?
0 answers
No public answers were preserved for this question.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
If you wish, you can fire a remoteevent that the tool interprets, and checks if the player is left clicking or not.