Heyo, I'm trying to create a sword that takes 5 damage each time you click but it keeps taking 5 damage multiple times per click? How would I fix this?
local tool = script.Parent
local safe = true
local function OnTouch(partOther)
if safe == false then
local humanOther = partOther.Parent:FindFirstChild("NPC")
if not humanOther then return end
humanOther:TakeDamage(5)
end
end
tool.Handle.Touched:Connect(OnTouch)
script.Parent.Activated:Connect(function() -- I thought this would work as a debounce?
safe = false
wait(1)
safe = true
end)
