You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
So, I’m making a wave-based attack system for my Tower defense game. I put all my wave information in a module script and require it afterwards. -
What is the issue? Include screenshots / videos if possible!
Spawn script won’t spawn zombies according to the module script, instead it outputs an error saying the value is nil -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried to look up the solutions on different sites but found nothing so far. I also tried printing out the value and it works as intented but still won’t spawn.
Module Script:
local module = {}
module.Data = {
["Waves"] = {
["WaveOne"] = {
"Zombie",
"Zombie",
"Zombie" },
["WaveTwo"] = {
"Zombie",
"Zombie",
"Zombie",
"Zombie",
"Zombie" }
}
}
return module
Spawn Script:
local WaveModule = require(script.WaveModule)
local Zombie = game.Workspace.Zombies.Zombie
local Speedy = game.Workspace.Zombies.Speedy
local ActiveZombies = game.Workspace.ActiveZombies
local function Spawn(Z)
local Clone = Z:Clone()
Clone.Parent = ActiveZombies
end
for i, v in pairs(WaveModule.Data.Waves.WaveOne)do
Spawn(v)
end