Spawn Kill Problem (TD Wave)

What was the problem?
I couldn’t achieve what i wanted.

What was the issue?
I couldn’t make the Wave progress as smooth as it was.

What was the main problem?
The problem is whenever the enemies are completed missing in the folder, it continues to proceed to the next Wave.

Here’s my script:

local DataStoreService = game:GetService("DataStoreService")
local PlaceTowerScript = require(game.ReplicatedStorage.PlaceTowerScript)
local WaveScript = require(game.ReplicatedStorage.WaveScript)

local MapType = game.Workspace:FindFirstChild(game.Workspace.Game.Map.Value)
local EnemiesSpawn = game.Workspace.Game.EnemiesSpawn

local ReplicatedStorage = game.ReplicatedStorage
local StartGameEvent = ReplicatedStorage.Functions.StartGameEvent
local TrimuphEvent = ReplicatedStorage.Functions.TriumphEvent

local Players = game:GetService("Players")

-------------------------------Game Function / Start-------------------------------

local Game = game.Workspace.Game

local WaveCount = Game.Wave
local Time = Game.Time

local Started = Game.Started

local Won = Game.Won

-------------------------------Game Function / End-------------------------------

local function ValuePerWave(wave : number)
	local baseValue = 300
	local maxValue = 3000
	local increment = (maxValue - baseValue) / 24
	
	local reward = baseValue + (wave - 1) * increment
	
	return reward
end




--// playerstats

local StoreExperience = DataStoreService:GetDataStore("StoreExperience")
local StoreWin = DataStoreService:GetDataStore("StoreWin")
local StoreLoss = DataStoreService:GetDataStore("StoreLoss")
local StoreCoin = DataStoreService:GetDataStore("StoreCoin")

Won.Changed:Connect(function(value : boolean)
	if value == true then
		Won.Value = false
		Started.Value = false
		
		for _, player in pairs(game.Players:GetPlayers()) do
				local playerstats = player:WaitForChild("playerstats")

			--// playerstats

			StoreExperience:SetAsync(player.UserId, playerstats.Experience.Value)
			StoreWin:SetAsync(player.UserId, playerstats.Win.Value)
			StoreLoss:SetAsync(player.UserId, playerstats.Loss.Value)
			StoreCoin:SetAsync(player.UserId, playerstats.Coin.Value)
		end
	end
end)


if game.Loaded then
	print("Started")
	
	repeat wait(1) until Started.Value == true
	
	game.Workspace.Game.Health.Value = 100
	
	StartGameEvent:FireAllClients()
	
	Time.Value = 10

	repeat task.wait() until Time.Value <= 0
	
	for wave = 1, 25 do
		
		-------------------------// REPEAT \\-------------------------
		
		WaveCount.Value = wave

		print("Wave "..wave.." has started")

		game.Workspace.Game.GameReward.CoinReward.Value = ((wave / 25) * 300)
		game.Workspace.Game.GameReward.ExperienceReward.Value = ((wave / 25) * 150)

		if wave == 25 then
			Time.Value += 999999999
		else
			Time.Value += 30
		end

		local Cashier = ValuePerWave(wave)

		for _, player in ipairs(Players:GetPlayers()) do
			local leaderstats = player:WaitForChild("leaderstats")
			local Cash = leaderstats:WaitForChild("Cash")

			Cash.Value += Cashier
		end
		
		-------------------------// MAIN FUNCTION \\-------------------------
		
		coroutine.wrap(WaveScript.Easy)(wave, MapType)
		
		-------------------------// REPEAT \\-------------------------

		
		repeat task.wait() until Time.Value <= 0 or #EnemiesSpawn:GetChildren() == 0
		-- This is the problem here, whenever the enemies are gone, the wave continues to the next wave, but the zombies are still spawning somehow
		
		Proceed = false

		Time.Value = 5

		repeat task.wait() until Time.Value <= 0
		
		if wave == 25 then
			print("Triumph!")
			
			Won.Value = true

			for i, player in pairs(game.Players:GetPlayers()) do
				local GameReward = game.Workspace.Game.GameReward

				local CoinReward = GameReward.CoinReward
				local ExperienceReward = GameReward.ExperienceReward


				local playerstats = player.playerstats

				local Experience = playerstats.Experience
				local Win = playerstats.Win
				local Coin = playerstats.Coin

				Experience.Value += ExperienceReward.Value
				Win.Value += 1
				Coin.Value += CoinReward.Value
			end

			TrimuphEvent:FireAllClients()
		end
		
		task.wait(1)
	end
end

You need to only break the loop once all of the enemies have been spawned, and have died, you are currently breaking it once there are no enemies on the map, which could occur during the spawning of them.

Can you be able to show me how?