Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make a wave spawn timer?

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.

1 comment

0

wait(120)

1 answer

✓ Accepted 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

0

You should use :GetChildren() and pairs instead of ipairs. The for loop won't work unless you give it a table.

0

What if I wanted to make it so that a certain round spawns more zombies of a certain type?

0

as in random? use math.random

This discussion is preserved as it was. New answers, comments, and votes are closed.