How do I fix this error?

I’m coding a wave-system following GnomeCode’s TD tutorial, and I keep getting this error, I’ve troubleshooted about 6 times already and it’s the same result.
Code:

local mob = require(script.Mob)
local map = workspace.Test

for wave=1,  10  do
	print("WAVE STARTING:" ,  wave)
	if wave <= 1 then
	elseif wave <= 1  then
		for i=1, 5 do
		mob.Spawn("Basic Dummy" ,  3  *  wave,   map)
	end
		
	
end
if wave <= 4 then
elseif wave <= 5 then
			for i=5, 8 do
				mob.Spawn("Fast Dummy", 3 * wave,  map)
			end

			if wave <= 7 then
			elseif wave <= 8 then
				for i=8, 10 do
					mob.Spawn("Tank Dummy", 4 * wave,  map)
				end
			
if wave <= 9 then
			elseif wave == 10 then
					for i=10, 10 do
						mob.Spawn("Basic Boss", 1 * wave,  map)
				end
			end
			
	repeat
		task.wait(01)
	until #workspace.Mobs:GetChildren() == 0
			print("WAVE ENDED")
			task.wait(1)
end

Error:


Any help would be helpful.

After these lines there’s supposed to be another end

I heavily recommend indentating your code, that’ll instantly tell you visually where you are missing the ‘end’ words.

I give up, I keep getting errors, my only chancing to rewrite the entire code

Try this:

local mob = require(script.Mob)
local map = workspace.Test

for wave=1,  10  do
	print("WAVE STARTING:" ,  wave)
	if wave <= 1 then
	elseif wave <= 1  then
		for i=1, 5 do
		mob.Spawn("Basic Dummy" ,  3  *  wave,   map)
	end
		
	
end
if wave <= 4 then
elseif wave <= 5 then
			for i=5, 8 do
				mob.Spawn("Fast Dummy", 3 * wave,  map)
			end

			if wave <= 7 then
			elseif wave <= 8 then
				for i=8, 10 do
					mob.Spawn("Tank Dummy", 4 * wave,  map)
				end
                           end
			
if wave <= 9 then
			elseif wave == 10 then
					for i=10, 10 do
						mob.Spawn("Basic Boss", 1 * wave,  map)
				end
			end
			
	repeat
		task.wait(01)
	until #workspace.Mobs:GetChildren() == 0
			print("WAVE ENDED")
			task.wait(1)
end

oh my god, i hate making games now :expressionless:


what the hell does it want me too do

Try this then:

local mob = require(script.Mob)
local map = workspace.Test

for wave=1,  10  do
	print("WAVE STARTING:" ,  wave)
	if wave <= 1 then
	elseif wave <= 1  then
		for i=1, 5 do
		mob.Spawn("Basic Dummy" ,  3  *  wave,   map)
            end
	end
		
	
end
if wave <= 4 then
elseif wave <= 5 then
			for i=5, 8 do
				mob.Spawn("Fast Dummy", 3 * wave,  map)
			end

			if wave <= 7 then
			elseif wave <= 8 then
				for i=8, 10 do
					mob.Spawn("Tank Dummy", 4 * wave,  map)
				end
                           end
			
if wave <= 9 then
			elseif wave == 10 then
					for i=10, 10 do
						mob.Spawn("Basic Boss", 1 * wave,  map)
				end
			end
			
	repeat
		task.wait(01)
	until #workspace.Mobs:GetChildren() == 0
			print("WAVE ENDED")
			task.wait(1)
end

I’m beginning to think that this is broken


To be fair the tutorial was like a 1 year ago, but how can this code be broken, it worked just fine before I put the waves in

That means wave is NIL and you are trying to say its a number.

Try this then:

local mob = require(script.Mob)
local map = workspace.Test

for wave=1,  10  do
	print("WAVE STARTING:" ,  wave)
	if wave <= 1 then
	elseif wave <= 1  then
		for i=1, 5 do
		mob.Spawn("Basic Dummy" ,  3  *  wave,   map)
            end
	end
		
	
if wave <= 4 then
elseif wave <= 5 then
			for i=5, 8 do
				mob.Spawn("Fast Dummy", 3 * wave,  map)
			end

			if wave <= 7 then
			elseif wave <= 8 then
				for i=8, 10 do
					mob.Spawn("Tank Dummy", 4 * wave,  map)
				end
                           end
			
if wave <= 9 then
			elseif wave == 10 then
					for i=10, 10 do
						mob.Spawn("Basic Boss", 1 * wave,  map)
				end
			end
			
	repeat
		task.wait(01)
	until #workspace.Mobs:GetChildren() == 0
			print("WAVE ENDED")
			task.wait(1)
end
end
1 Like

It works! Wave Delay isn’t there but i think that can be an easy troubleshoot

1 Like

No problem bro. Ask if you have any questions.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.