local Zombie = script.Parent local Cooldown = require(game:GetService("ServerScriptService").ZombieCooldownModule) local wave -- for wave stuff local debounce while true do for _, child in ipairs(Zombie:GetChildren()) do if child:IsA("BasePart") then child.Touched:Connect(function(part) local partParent = part.Parent local humanoid = partParent:FindFirstChildWhichIsA("Humanoid") if not humanoid then return else if humanoid and partParent.name ~= "Zombie" and Zombie.Humanoid.Health ~= 0 then if not Cooldown:Check(partParent) then humanoid.Health = humanoid.Health - 10 local currenttime = os.time() Cooldown:Add(partParent,currenttime) end end end end) end end wait(1) end
The above code is supposed to damage the player when the script parent touches the player. However, even after the player stops touching the script parent, it continues to damage.
I can't figure out the bug, and I'm almost certain that the bug occurs here.