How can i make enemies spawn on random location on my part?
So there are probably a lot of issues with this script, but im trying to spawn 25 enemies on this part that i have named enemyspawn. The problem is that itll spawn only one if i set up the vector. However, if i dont set the vector itll spawn all 25.
03 | local ServerStorage = game.ServerStorage |
05 | local function spawnEnemies(count) |
06 | local spawnpoint = game.Workspace.enemyspawn.Size |
11 | local enemy = ServerStorage.Enemies.Gladiator:Clone() |
12 | enemy.Parent = game.Workspace.enemyspawn |
14 | local randomX = math.random(spawnpoint.X) |
15 | local randomZ = math.random(spawnpoint.Z) |
16 | enemy.Position = Vector 3. new(randomX , 10 , randomZ) |
21 | spawnEnemies(ENEMY_COUNT) |