-
What do you want to achieve? Keep it simple and clear!
I want to correctly debounce a punch ability -
What is the issue? Include screenshots / videos if possible!
The punch works on touch, when I press the R key, although, after I press R key, even when the punch has ended, it will still do damage to whatever I touch -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have tried countlessly looking for different tutorials on this matter. Although, none seem to work…
Part of my code:
elseif input.KeyCode == Enum.KeyCode.R and not istyping then
if CanDoDamage == true then
CanDoDamage = false
local anim = hum:LoadAnimation(script.DonutAnim)
anim:Play()
hum.Parent:FindFirstChild("Right Arm").Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
hit.Parent.Humanoid:TakeDamage(50)
CanDoDamage = false
wait(1.5)
CanDoDamage = true
end
end)
end