So Im currently making a td game and Im making a functional wave system. I have a module called “Waves” which is basically a dictionary of all waves in the system:
Waves Module:
local WaveHandler = {}
WaveHandler.Easy = {
["Wave1"] = {
["Max Time"] = 10,
["Wave Structure"] = {
[9] = "Mom",
[7] = "Mom",
[5] = "Mom",
[3] = "Mom"
}
}
}
return WaveHandler
and in a server script we iterate this dictionary and get all the wave info
function startWave()
for index, wave in pairs(WaveHandlerModule.Easy) do
TimeLeft.Value = WaveHandlerModule.Easy["Wave" .. CurrentWave]["Max Time"]
coroutine.resume(SpawnTimer)
for _, obj in pairs(WaveHandlerModule.Easy["Wave" .. CurrentWave]) do
if not (obj == 10) then
repeat task.wait() until enemyFolder:WaitForChild(obj[TimeLeft.Value])
print(obj[TimeLeft.Value])
print(TimeLeft.Value)
local spawnEnemy = coroutine.create(function()
EnemyHandlerModule.SpawnEnemy(enemyFolder:FindFirstChild(obj[TimeLeft.Value]))
end)
coroutine.resume(spawnEnemy)
end
end
end
end
but the problem is I do not know how to check if our “obj” is at [“Max Time”], and iterating directly trough the wave layout leaves out these part
and returns only “Mom”