I made this script which when you click the either Q or E. Will play up an animation, then if a player touches the body part, then it damage them from a remote function. But once i click Q or E {Punching and Kicking} You could damage the player infinitely, what i ment is after 1 click of Q and E and you can keep the touching the target player and they will die. I tried to add a disconnect line when they touch a player / NPC, then you can't damage them until you click Q or E again.
if input.KeyCode == Enum.KeyCode.Q and player.Character and player.Character.Humanoid.Health > 0 and not chat and not action and not punchdebounce and not kickdebounce and not releasedebounce then
punchdebounce = true
action = true
local checkplaying = checkstat:InvokeServer("Playing", "BaseValue")
local checkvalue = checkstat:InvokeServer("Eternity", "BaseValue")
if checkplaying == true and checkvalue >= 0 then
PlayAnimation(animations[1], sounds[1], "Punch")
changestat:InvokeServer("Exp", punchexp * expmultiplier.Value, "Add")
--MAIN TOUCHING SCRIPT IS HERE
touch1 = player.Character:WaitForChild("LeftLowerArm").Touched:connect(function(part)
if touch == false and part.Parent:FindFirstChild("STATSFOLDER") or part.Parent:FindFirstChild("Health") then
touch = true
damagefunction:InvokeServer(part.Parent, "Punch")
touch1:disconnect()
end
end)
touch2 = player.Character:WaitForChild("RightLowerArm").Touched:connect(function(part)
if rtouch == false and part.Parent:FindFirstChild("STATSFOLDER") or part.Parent:FindFirstChild("Health") then
rtouch = true
damagefunction:InvokeServer(part.Parent, "Kick")
touch2:disconnect()
end
end)
wait(waitperattack)
punchdebounce = false
touch = false
rtouch = false
else
punchdebounce = false
action = false
end
end
-MAIN TOUCHING SCRIPT ENDS HERE
I hope this is informative enough c:

1 comment
They're suppose to be debounces