I made a basic punch script but there is a problem. I made a local script in starterpack and made a keydown function,when you press e your arms move and and it makes a punch noise after that it executes this script below which deals the damage, the problem is When a humanoid touches the left arm it automatically does damage when I don't press "e" any help?
local debounce = false
function onDamage(Part)
if not debounce then
debounce = true
if Part.Parent:FindFirstChild("Humanoid")~= nil and Part.Parent.Name ~= "script.Parent.Name" then
script.Parent.hit:Play()
Part.Parent.Humanoid.Health = Part.Parent.Humanoid.Health -1.4
wait(1)
debounce = false
end
end
end
script.Parent.Parent.Parent.Character["Left Arm"].Touched:connect(onDamage)

5 comments
because it fires whenever the arm is touched, not when you punch & arm is hit
...huh? so line 16 is the problem...How would I change it?
ContextActionService is probably the best way to do that.
okay thanks
Still cant figure it out