Ok, so I've ran into a little bit of a problem, I'm making a zombie spawner script and the zombies do spawn, but instead of spawning in all the possible spawn locations (which are invisible Parts) they all spawn in the same one
This is the spawn function:
function Commands.SpawnZombie(amount, class, safeMode)
local zombieType = game.ReplicatedStorage.Zombies[class]
for i = 1, amount do
if safeMode == true then
if game.ReplicatedStorage.ServerDetails.RoundActive == false then
return
end
end
local zombie = zombieType:Clone()
zombie.Parent = game.Workspace.NPCs
local RandomSpawnLocation = GetRandomSpawnLocation()
zombie.PrimaryPart.CFrame = RandomSpawnLocation.CFrame
end
end
And this is the GetRandomSpawnLocation() function:
function GetRandomSpawnLocation()
local SpawnZones = game.Workspace.Map.SpawnZones:GetChildren()
local randomSpawnZone = SpawnZones[math.random(1, #SpawnZones)]
local SpawnLocations = randomSpawnZone:GetChildren()
local RandomSpawnLocation = SpawnLocations[math.random(1, #SpawnLocations)]
return RandomSpawnLocation
end
A bit of information: The GetRandomSpawnLocation basically gets a random SpawnZone (which is a big part with alot of small parts inside it) then it gets a random SpawnLocation which are one of the small parts, and returns that location
But as i said, even tho im firing the function every loop, it still spawns them in the same place. why does this happen? please help :c

10 comments
..
Also forgot to mention try putting the pads in a folder and name it SpawnPad if that doesn't work name it to ZombieSpawns
Rename folder to**
Also can you maybe give me a screenshot? Upload your screenshot as a decal on Roblox and give me the link.
Upload decals here https://www.roblox.com/develop?View=13
I added a screenshot on your answer, it's from the Lightshot app
Have you tried using break points and call stack to debug? Or maybe printing the tables?
Sorry, I don't know what break points and call stack are, I can try printing the table tho
Nothing, it's printing what it's supposed to print, the table of spawnpads, Idk what to do anymore lol, is there any chance that it being a ModuleScript is making it break? because the spawn function is fired from another script, calling the Spawn Module Script
probably try normal script