Hi I am trying to add types of zombies to a list and it keeps telling me [12:15:10.252 - ServerScriptService.Main:162: attempt to call a nil value] when the script gets to
local regularZombies = mapZombies:WaitForChild("RegularZombies"):GetChildren()
Am I doing something wrong? Here is my code:
if round.Value == 0 then --load a random map
statustag.Value = "Loading New Map"
timertag.Value = 0
print('First round, loading new map')
mapholder:ClearAllChildren()
wait(4)
local allmaps = maps:GetChildren()
mapIndex = math.random(1, #allmaps)
mapName = allmaps[mapIndex].Name
newMap = allmaps[mapIndex]:Clone()
newMap.Parent=mapholder
newMap.Name = "Map"
local zombiesFolder = Instance.new("Folder")
zombiesFolder.Name = "ZombiesHolder"
zombiesFolder.Parent = mapholder
round.Value = round.Value + 1
for k, player in pairs(contestants) do
local leaderstats = player:WaitForChild("leaderstats")
local points = leaderstats:WaitForChild("Cash")
points.Value = 0
end
wait(4)
end
-- Zombie Selection --
local availableZombies = {}
local mapZombies = serverStorageZombies:WaitForChild(mapName):GetChildren()
local regularZombies = mapZombies:WaitForChild("RegularZombies"):GetChildren()
local fastZombies = mapZombies:WaitForChild("FastZinbues"):GetChildren()
local strongZombies = mapZombies:WaitForChild("StrongZombies"):GetChildren()