I have a zombie game. In the barrier (Where the zombies come from) it should have a zombie spawn. So when a zombie dies or even doesn't die, it should spawn a zombie every 5 seconds. Then when they hit the wood that COVERED the barrier, it breaks after 4 hits. Help?
COMMUNITY QUESTION
How do I make a zombie spawner?
1 answer
Follow These Steps
- Insert a script into your zombie (The Model)
- Write
script.Parent:clone().Parent = ReplicatedStorage
H = script.Parent.Humanoid.Health
if H == 0 then
wait(5) -- regen time
game.ReplicatedStorage.Zombie:clone().Parent = game.Workspace --change Zombie to the name of the zombie
end
I'm pretty sure this will work Then for the wood you could make it so. If it's hit by a humanoid it breaks after 5 secs Or so they wood has health and the zombies do damage. For the wood having health here are the steps
- Create the wood 2.Group the wood and some other part
- Then take the part out and put it back. Then in the Model with wood in it insert a humanoid
- Insert a script and write
Health = script.Parent.Humanoid.Health --Finding the Health in humanoid
if Health == 0 then --if health is 0 then
script.Parent.Wood.CanCollide = false -- make the wood passable
script.Parent.Wood.Transparancy = 1 -- make the wood invisible
- In the zombie go into the arms and create a script
- Write
function onTouched(part)
local humanoid = part.Parent:FindFirstChild("Humanoid")
if (humanoid ~= nil) then -- if a humanoid exists, then
humanoid.Health = -25 -- damage the humanoid by 25 (4 hits kills it)
end
end
script.Parent.Touched:connect(onTouched)
If it doesn't work change the part where it says humanoid.Health = -25 to humanoid.Health = 0 that will kill it instantly tho :p
Thanks for reading and I hope I helped plz accept my answer and comment if u have questions
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
The first script you posted wouldn't regenerate the zombie after it's killed. You should use the Died event to determine when a humanoid dies. If not the Died event, then you need to use the Changed event and check if the health is below 0 when it fires. At it's current state, it'll run once when the zombie spawns (and has 100% health) and never run again.
ok thanks