db = false script.Parent.Touched:connect(function(hit) pcall(function() if db == false then db = true hit.Parent.Humanoid:TakeDamage(50) wait(1) db = false wait(1) db = true end end) end)
My script works, except for the fact that when the zombie is hit, he no longer does any damage. Does anyone know why? Should this be in a loop? Edit: Wait no it only hits once now?
It could have been due to your Debounce which you set to true after the script has run making it not work any longer, you should also check if the Touched part has a Humanoid in the first place. You don't want this to trigger if the zombie touches something such as a wall which would return nil. Try this.
db = false script.Parent.Touched:Connect(function(hit) if db == false then if hit.Parent:FindFirstChild("Humanoid") then hit.Parent.Humanoid:TakeDamage(50) wait(1) db = false end end end)