I've been trying to figure this out for a while but nothing seems to be working can i have help all i want is so when you left click the damage is active for only 3 seconds, this is just so i don't have to worry about somebody running into the blade and dying without me actually attacking them IMPORTANT: the script is in a part called: blade (no caps) (it's the hitbox of the sword essentially)
local debounce = false
local HealthLoss = 35 -- Damage
function OnTouched(Part)
if Part.Parent ~= nil then
if debounce == false and Part.Parent:findFirstChild("Humanoid") ~= nil then
debounce = true
Part.Parent:findFirstChild("Humanoid"):TakeDamage(HealthLoss)
wait(2)
debounce = false
end
end
end
script.Parent.Touched:connect(OnTouched)

6 comments
a simple debounce can't prevent death from running into a sword
cant or can?
pretty sure i said can't in my comment
k
wait wdym debounce i don't think i mentioned it
maybe use an Activated event and a GetTouchingParts function or use FindPartOnRay