local waitTime = 0.2
local Debounce = false
local Char = {}
local function Touched(hit)
if not Debounce then
if not hit.Parent:FindFirstChild("Humanoid") then return end
Debounce = true
hit.Parent:SetAttribute("Damage", true)
table.insert(Char, hit.Parent)
wait(waitTime)
Debounce = false
end
end
local function TouchEnded(hit)
if not Debounce then
if not hit.Parent:FindFirstChild("Humanoid") then return end
Debounce = true
hit.Parent:SetAttribute("Damage", false)
table.remove(Char, table.find(hit.Parent))
wait(waitTime)
Debounce = false
end
end
script.Parent.Touched:Connect(Touched)
script.Parent.TouchEnded:Connect(TouchEnded)
while task.wait(waitTime) do
if table.getn(Char) > 0 then
for _, Plr in pairs(Char) do
if Plr:GetAttribute("Damage") == true then
Plr.Humanoid:TakeDamage(10)
end
end
end
end
help
