I'm trying to make a punch system that does 5 damage per hit. But for some reason it does way more than 5 damage. I know it has something to do with debounces but I already did add a debounce. I know I'm not very good with scripting. Please help, thanks much.
local UIS = game:GetService("UserInputService")
local attacking = false
llocal function leftPunch()
--Animation
local leftPunch = script.LeftPunch
local leftPunchTrack = humanoid:LoadAnimation(leftPunch)
local leftFist = character:WaitForChild("Left Arm")
if not LPcooldown then
LPcooldown = true
attacking = true
leftPunchTrack:Play()
wait(2)
LPcooldown = false
end
--Damage
leftFist.Touched:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChildWhichIsA("Humanoid")
if humanoid and attacking then
humanoid:TakeDamage(5)
wait() --debounce
attacking = false
end
end)
end

1 comment
Thanks!!!