I wanted to know how I could make a wave timer where after a certain number ( seconds,minutes,hours, etc.) it would spawn zombies or something.
How do I make a wave spawn timer?
1 answer
I assume you want them to spawn in the same place, if so do this:
What you should do is make a folder in ServerStorage called NPC, in that folder (If you have more than 1 NPC type) put Folders called your NPCs Types (e.g Zombies), and in that folder put your NPCs (position them in the workspace first!). Then, in a script (probably in workspace), put this code:
while true do
wait(time)
for _, zombie in ipairs (game.ServerStorage.NPC.Zombies) do
zombie:Clone().Parent = game.Workspace
end
end
What it does is makes an infinite loop, and in that loop waits a certain amount of time, then uses a for loop to clone each zombie and place it in the workspace.
3 comments
You should use :GetChildren() and pairs instead of ipairs. The for loop won't work unless you give it a table.
What if I wanted to make it so that a certain round spawns more zombies of a certain type?
as in random? use math.random
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
wait(120)