Wavemanager module script:
local WaveManager = {}
wavussy = 0
function WaveManager.setWave(wave)
wavussy = wave
end
function WaveManager.getWave()
return wavussy
end
return WaveManager
Gui script:
local WaveManager = require(game:GetService("ReplicatedStorage").WaveManager)
while true do
task.wait(1)
local wavussy = WaveManager.getWave() -- Ensure we get the latest wave value
if wavussy then
script.Parent.Text = "wave " .. tostring(wavussy)
else
script.Parent.Text = "wave unknown"
end
end
wave script:
local enemy = require(script.Spawn)
local WaveManager = require(game:GetService("ReplicatedStorage").WaveManager)
local map = game.Workspace.island
for wave = 1, 5 do
print("wave:", wave)
WaveManager.setWave(wave)
if wave == 1 then
enemy.Spawn("BigPoo", 4, map)
elseif wave > 1 then
enemy.Spawn("BigPoo", 2 * wave, map)
end
repeat
task.wait(1)
until #map.enemies.enemies:GetChildren() == 0
print("wave done")
end
I've tried to use print to see if its wave's value is being saved to "wavussy", it is, but returns nil, how do i fix this?


** You are now Level 4! **