Hi i making fighting game, but there is a problem when click on weapon and animation end then i walked to dummy and it still take damage can anyone fix this here my part of code that i think it problem
local canDamage = false
local canSwing = true
local function onTouch(otherPart)
local humanoid = otherPart.Parent:FindFirstChild("Humanoid")
if not humanoid then
return
end
if humanoid.Parent ~= tool.Parent and canDamage then
humanoid:TakeDamage(10)
canDamage = false
humanoid.WalkSpeed = 0.5
wait(1)
humanoid.WalkSpeed = 16
else
return
end
canDamage = false
end
local canDamage = true
local canSwing = true
local function onTouch(otherPart)
local humanoid = otherPart.Parent:FindFirstChild("Humanoid")
if not humanoid then
return
end
if humanoid.Parent ~= tool.Parent and canDamage then
humanoid:TakeDamage(10)
canDamage = false
humanoid.WalkSpeed = 0.5
task.wait(1)
humanoid.WalkSpeed = 16
else
return
end
task.wait(1)
canDamage = true
end