How do I add a limit zombies spawning in? Please help
COMMUNITY QUESTION
How do I add a limit zombies spawning in?
1 answer
Fine, Even though you didn't attempt. Here you go.
Add a Zombie to "ServerStorage"
Change the Zombies name to "Zombie"
Add this script into "ServerScriptService"
local zombie = game.ServerStorage.Zombie
local maxZombies = 250 -- Set this number to the max amount of zombies you want.
local currentZombies = Instance.new("IntValue")
currentZombies.Value = 0
while true do
wait(0.1)
if currentZombies.Value < maxZombies then
repeat
currentZombies.Value = currentZombies.Value + 1
wait(5) -- This is the cool down time, set it to whatever you would like.
until currentZombies.Value == maxZombies
end
end
while true do
wait(0.1)
if currentZombies.Value < maxZombies then
repeat
local z = zombie:Clone()
z.Parent = game.Workspace
local human = Instance.new("Humanoid")
human.Parent = z
if z.Humanoid.Health == 0 then
currentZombies.Value = currentZombies.Value - 1
end
wait(5)
until currentZombies.Value == maxZombies
end
end
Your welcome..
2 comments
0
Lol somebody downvoted you. I don't have enough rep to do so, but I would have, I would had downvoted you too. Don't help people who doesn't know to script, please!
2
LOl the script doesn't even work
This discussion is preserved as it was. New answers, comments, and votes are closed.

6 comments
I can see that you have no idea about coding. Scripting Helpers is nor a rquest site, so at least I won't help with this. Once you learnt to code, you can ask for help if you can't fix a glitch, or whatever. Scripting Helpers is not a website for beginners.
What you could do is that when a zombie spawns it adds into a value, counting how many zombies there are, and if the number equals or exceeds it'll prevent anymore from spawning.
[Continued] And when a zombie dies, you subtract the value by 1. Zombie Added = Value + 1, Zombie Died = Value - 1
http://wiki.roblox.com/index.php?title=API:Class/Humanoid/Died
http://wiki.roblox.com/index.php?title=Arithmetic_operator
http://wiki.roblox.com/index.php?title=Variable