Help checking '#' instances in a dictionary

I am currently trying to run a basic game loop with an intermission and an attack wave, then another intermission once all of the enemies have been killed, Ive tried checking if dictionary == {}, #dictionary == 0 and using table.find() to check if anything is in there, however it either seems to not trigger the ‘until’ at all or fires it instantly. Any help is appreciated, Ive seen a lot of posts about this but no answers so far.

function Game:_Intermission()
	
	local timer = 5
	local i = 0
	
	repeat
		
		i += 1
		print(i)
		task.wait(1)
		
	until i == timer --or (insert skip logic)
	
	self:_StartWave()
	
end

function Game:_StartWave()
	
	self.Stats.Wave += 1
	local Spawns = workspace:FindFirstChild("Spawns")
	for i = 1,self.Stats.Wave do
		
		local rndSpawn = Spawns[math.random(1,#Spawns:GetChildren())].Position
		local Clone = ReplicatedStorage.Noob:Clone()
		Clone.Name = Clone.Name..i
		local newZombie = Zombie.new(Clone, rndSpawn)
		newZombie:Spawn(rndSpawn)
		task.wait(2)
		
	end

	repeat
		task.wait(1)
		print("zombie count ".. #Zombie.Zombies)
	until #Zombie.Zombies == 0
	
	self:_Intermission()
	
end

the Zombie.Zombies dictionary is definitely being updated correctly by the way

solved it! please ignore its now allowing me to delete it

You should say how you got to your solution in case someone has a similar problem to you and needs help.

3 Likes

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