So I'm trying to make Zombies spawn randomly across my map but I'm having trouble with it. I'm following this guide (https://education.roblox.com/en-us/resources/arcade-game-spawning-enemies) and it works for Parts but not a Model. Basically it'll spawn the 100 Enemy Balls on my map but when I change it to fit my Zombies it only spawns 1 of them and when I kill it it doesn't respawn. Here is the Zombie I am using (https://www.roblox.com/library/3924238625/Drooling-Zombie-Rthro) and here is my code
-- Randomly spawns the number of enemies set in ENEMY_COUNT
local ENEMY_COUNT = 100
local SAFE_ZONE_SIZE = 50
local RESPAWN_DURATION = 3
local ServerStorage = game:GetService("ServerStorage")
local function spawnEnemies(count)
local baseplateSize = workspace.Baseplate.Size
-- Loops until there are the amount of enemies set in ENEMY_COUNT
for i = 1, count do
-- Makes a copy of EnemyBall
--local enemy = ServerStorage.Enemies.EnemyBall:Clone()
local enemy = ServerStorage.Enemies.Zombie:Clone()
enemy.Parent = workspace.Enemies
-- Places EnemyBall randomly on the baseplate
local randomX = math.random(baseplateSize.X / -2 - SAFE_ZONE_SIZE, baseplateSize.X / 2 + SAFE_ZONE_SIZE)
local randomZ = math.random(baseplateSize.Z / -2 - SAFE_ZONE_SIZE, baseplateSize.Z / 2 + SAFE_ZONE_SIZE)
enemy.Position = Vector3.new(randomX , 20, randomZ)
end
end
-- Have enemies spawn on the baseplate
spawnEnemies(ENEMY_COUNT)
Also a side question, how would I go about spawning from ServerStorage.Enemies folder so I could add different looking zombies? Any help would be greatly appreciated. Thanks in advance!
