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)
Does the script check to see if the "e" key is pressed? The script should check to see if debounce = false and if the "E" key was pressed by the player.
If you are checking for both of those, then I really can't suggest any solutions. Perhaps you made some sort of typo, or typed "parent" instead of "Parent".
I hope my answer helped you.