I have a for loop
that is supposed to spawn zombies on different locations but I encounter two errors. Number one, the zombie dies immediately after he got teleported, and number two I get this in the output Position is not a valid member of NumberValue
. This output is different each time I load the game. Sometimes NumberValue, sometimes script and sometimes even camera get displayed at the end of the error output.
local zombieSpawns = workspace:GetChildren("zombieSpawns") for i = 1, zombieAmount.Value do local Zombies = workspace:GetChildren("Zombiess") if #Zombies <= zombieMax then local zombieClone = game:GetService("ServerStorage").Zombie:Clone() zombieClone.Parent = workspace.zombiess local randomSpawn = math.random(1, #zombieSpawns) zombieClone:MoveTo(zombieSpawns[randomSpawn].Position + Vector3.new(0,1,0)) end end
Thanks in advance, Kryddan