So i'm making a sword but it hurts people without me even swinging it. I added a thing that fixed that though but now you can spam the sword to as many times as you want making the debounce i made basically useless. Is there a way to make it so my sword doesn't hurt people without being activated and have it have a swing cool down?
Here is my script.
script.Parent.Equipped:Connect(function()
script.Parent.Activated:Connect(function()
script.Parent.Blade.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild('Humanoid') then
hit.Parent.Humanoid:TakeDamage(5)
local clone = script:Clone()----------
clone.Parent = script.Parent--------- Debounce
script:Destroy()--------------
end
end)
local animation2 = script.Parent.SideSwipe
local play2 = script.Parent.Parent:WaitForChild("Humanoid"):LoadAnimation(animation2)
play2:Play()
script.Parent.Attack:Play()
end)
end)

1 comment
Thank you!