✓ Accepted answer
I will delete this answer if it still not working:
game.Workspace.DescendantAdded:Connect(function(brains)
if brains.Name == "name?" then
local findinghealth = brains:FindFirstChild("Humanoid") or brains:FindFirstChildOfClass("Humanoid")
if findinghealth then
findinghealth.Health = 0
print("Zombie is killed! Hooray!")
end
end
if not brains.Name == "same as the zombie's name please" then
warn("You found a wrong zombie! Try again please! --cherrythetree")
end
end)
This first find the name of the zombie then finds if the zombie has health.
The event DescendantAdded will function if a part/model/etc. is added in game.Workspace. And you notice that there is brains* after function.
Example:
brains* has a mission to find a object's name like for example: "Drooling Zombie" then he found one and killed the zombie by finding its health.
4 comments
Maybe specify why their scripts aren't working for you instead of just saying "doesn't work"..? Both of their scripts would work in your case...
it snot killing the npcs, i have a script where it would disable the npc spawn (which works) but now im trying to kill the npcs that are still in workspace (alive)
you need to find the zombie.
uh...