This is the line of code i used and it's inside a server script
--//Variables
local tool = script.Parent
local player = tool.Parent.Parent
local char = player.Character
local hum = char:WaitForChild('Humanoid')
local debounce = false
--//Activated
tool.Activated:Connect(function()
--//Animation
local animation = Instance.new('Animation')
animation.AnimationId = "rbxassetid://2690844038"
local load = hum:LoadAnimation(animation)
if not debounce then
debounce = true
load:Play()
wait(0.5)
debounce = false
end
end)
local debounce2 = false
--//Touched
tool.Handle.Touched:Connect(function(hit)
if debounce and hit and hit.Parent:FindFirstChild('Humanoid') and not debounce2 then
debounce2 = true
hit.Parent.Humanoid:TakeDamage(10)
wait(0.5)
debounce2 = false
end
end)
Here's a gif that shows the problem. https://gyazo.com/c2df592e8e8bee75ab45651dc8772d60

3 comments
please try clicking slower and let me know if the issues continues
try replacing wait(0.5) with repeat wait() until not debounce on line 29 and does the animation last for exactly 0.5 seconds?
Yes it's exactly 0.5 and it didn't work sorry.