Zombie Damages even when their not touching me?
01 | local Zombie = script.Parent |
02 | local Cooldown = require(game:GetService( "ServerScriptService" ).ZombieCooldownModule) |
07 | for _, child in ipairs (Zombie:GetChildren()) do |
08 | if child:IsA( "BasePart" ) then |
09 | child.Touched:Connect( function (part) |
10 | local partParent = part.Parent |
11 | local humanoid = partParent:FindFirstChildWhichIsA( "Humanoid" ) |
16 | if humanoid and partParent.name ~ = "Zombie" and Zombie.Humanoid.Health ~ = 0 then |
17 | if not Cooldown:Check(partParent) then |
18 | humanoid.Health = humanoid.Health - 10 |
20 | local currenttime = os.time() |
21 | Cooldown:Add(partParent,currenttime) |
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.