I just need a simple debounce of 2 seconds, i tried to do it myself but i'm a bit special so yea
local tool = script.Parent.Parent --your tool local toolActive = false local damage = 1 local duration = 2 local function onTouched(hit) if not toolActive then do return end end local Humanoid = hit.Parent:FindFirstChildOfClass("Humanoid") if Humanoid then Humanoid:TakeDamage(damage) end end local function onActivated() if toolActive then do return end end toolActive = true; wait(duration); toolActive = false end script.Parent.Touched:Connect(onTouched) tool.Activated:Connect(onActivated)
You can use tables to identify if the target player was damaged or not.
local tool = script.Parent.Parent --your tool local toolActive = false local damage = 1 local duration = 2 local damagedChars = {} local function checkIfDamaged(x) for index, value in pairs(damagedChars) do if value == x then return true end end return false end local function onTouched(hit) if not toolActive then do return end end local Humanoid = hit.Parent:FindFirstChildOfClass("Humanoid") if Humanoid and not checkIfDamaged(Humanoid.Parent.Name) then Humanoid:TakeDamage(damage) table.insert(damagedChars, Humanoid.Parent.Name) end end local function onActivated() if toolActive then do return end end toolActive = true; wait(duration); toolActive = false damagedChars = {} end script.Parent.Touched:Connect(onTouched) tool.Activated:Connect(onActivated)