So I have a script for when you press Q if plays a punching animation, does anyone know how to make it so it damages? I wanna make sure it only enables damaging once the key is pressed
COMMUNITY QUESTION
How do I add damage to my punches?
1 answer
what you should do is create a punching variable
local punching = false
then when you click q you make the bool true, after the animation is over set it back to false
Now you should create a touched event for the end of the arm, specifically the RightHand & LeftHand if you are using R15, if R6 just the Right Arm and Left Arm will work.
Example, I made it so that when the righthand is touched it should check that the thing that touched it is not from that character and that there is a humanoid in its parent.
local punching = false
character.RightHand.Touched:connect(function(hit)
if hit.Parent~=character and hit.Parent:FindFirstChild("Humanoid")~=nil and punching==true then
hit.Parent.Humanoid:TakeDamage(10)
end
end)
This example is for the RightArm, you should have to set it up for the LeftHand as well if this was for R15 and the other way around for R6.
This discussion is preserved as it was. New answers, comments, and votes are closed.

10 comments
What is "character" in the example code?
@OptiBloxxer the character who is punching
So do I have to create a variable?
And I'm only using R6, and I replace RightHand with RightArm the output says it's not apart of the model.
This was only an example, not a complete script, in R6 there is no RightHand, there is a "Right Arm" and a "Left Arm"
@OptiBloxxer
@DanzLua I know that theres no RightHand in R6, but how do you put Right Arm into the script? Since if I replace RightHand with RightArm it doesn't work. If I make a space as in "Right Arm" To replace "RightHand" in the code it doesn't work.
character["Right Arm"].Touched
So is "character" character = player.Character?
@OptiBloxxer sure