Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make a zombie spawner?

Asked by 10 years ago

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?

1 answer

Log in to vote
0
Answered by 10 years ago

Follow These Steps

  1. Insert a script into your zombie (The Model)
  2. 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

  1. Create the wood 2.Group the wood and some other part
  2. Then take the part out and put it back. Then in the Model with wood in it insert a humanoid
  3. 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 

  1. In the zombie go into the arms and create a script
  2. 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

1
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. nate890 495 — 10y
0
ok thanks SirKitten2000 0 — 10y
Ad

Answer this question