Script shows no errors yet spawns nothing. Any optimizations I need to make?

I decided to open up Studio today and make a tower defense game. However, my wave system won’t work. Output bar isn’t giving me any errors, what’s the problem?

local wave1 = {"noob", "noob", "noob", "noob", "noob"}
local wave2 = {"noob", "noob", "mininoob", "mininoob"}
local wave3 = {"noob", "noob", "noob", "mininoob", "mininoob", "mininoob", "noob" ,"noob"}
local wave4 = {"mininoob", "mininoob", "mininoob", "strongnoob"}
local wave5 = {"mininoob", "mininoob", "strongnoob", "strongnoob", "noob", "noob"}
local wave6 = {"strongnoob", "strongnoob", "strongnoob", "strongnoob"}
local wave7 = {"zippynoob", "zippynoob", "zippynoob", "zippynoob"}
local wave8 = {"zippynoob", "zippynoob", "mininoob", "mininoob", "strongnoob", "strongnoob", "strongnoob", "strongnoob", "noob", "noob"}
local wave9 = {"zippynoob", "zippynoob", "zippynoob", "zippynoob", "strongnoob", "strongnoob", "strongnoob", "noob", "noob"}
local wave10 = {"zippynoob", "zippynoob", "burlynoob"}
local wave11 = {"zippynoob", "zippynoob", "zippynoob", "zippynoob", "burlynoob", "burlynoob", "strongnoob", "strongnoob"}
local wave12 = {"burlynoob", "burlynoob", "burlynoob", "burlynoob", "strongnoob", "strongnoob", "zippynoob"}
local wave13 = {"burlynoob", "burlynoob", "goliath"}

local waveslist = {wave1, wave2, wave3, wave4, wave5, wave6, wave7, wave8, wave9, wave10, wave11, wave12, wave13}



wait(10)
print("Game start")



-- Start the game
for wave = 1, #waveslist do
	local waveselection = waveslist[wave]
	for monster = 1, #waveselection do
		-- Spawn creatures
		if monster == "noob" then
			local newmonster = game.ReplicatedStorage.Waves.Noob:Clone()
			newmonster.Parent = game.Workspace
			wait(2.5)
		end
		
		if monster == "mininoob" then
			local newmonster = game.ReplicatedStorage.Waves.MiniNoob:Clone()
			newmonster.Parent = game.Workspace
			wait(1.5)
		end
		
		if monster == "strongnoob" then
			local newmonster = game.ReplicatedStorage.Waves.StrongNoob:Clone()
			newmonster.Parent = game.Workspace
			wait(5)
		end
		
		if monster == "zippynoob" then
			local newmonster = game.ReplicatedStorage.Waves.ZippyNoob:Clone()
			newmonster.Parent = game.Workspace
			wait(4)
		end
		
		if monster == "burlynoob" then
			local newmonster = game.ReplicatedStorage.Waves.BurlyNoob:Clone()
			newmonster.Parent = game.Workspace
			wait(8)
		end
		
		if monster == "goliath" then
			local newmonster = game.ReplicatedStorage.Waves.Goliath:Clone()
			newmonster.Parent = game.Workspace
			wait(1)
		end
	end
	wait(10)
end

I will probably have to optimize this script later as well…

NOTE: It does print “Game Start” if that’s helpful. The script is also a normal script in the workspace.

1 Like

Whoops! Rookie mistake! Figured out I didn’t assign the “monster” value anything other than a number.

3 Likes