im creating a Sword For The Client Side But When I try to kill the enemy (the enemy is client side) it kills him right away and the enemy has 3 health
the script in the sword:
local Sword = script.Parent
local Handle = Sword.Handle
local Debounce = false
function TakeDamage(hit)
local Humanoid = hit.Parent:FindFirstChild("Humanoid")
if Humanoid and Humanoid.Health >= 1 then
Humanoid:TakeDamage(1)
end
end
Sword.Activated:Connect(function()
if Debounce == false then
Debounce = true
Handle.SwordSlash:Play()
local TakeDamage = Handle.Touched:Connect(TakeDamage)
wait()
TakeDamage:Disconnect()
wait(1)
Debounce = false
end
end)
Sword.Equipped:Connect(function()
Handle.Unsheath:Play()
end)
thanks for the collaboration