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.

 
local ENEMY_COUNT = 25
 
local ServerStorage = game.ServerStorage
 
local function spawnEnemies(count)
	local spawnpoint = game.Workspace.enemyspawn.Size
 

	for i = 1, count do

		local enemy = ServerStorage.Enemies.Gladiator:Clone()
		enemy.Parent = game.Workspace.enemyspawn
		
		local randomX = math.random(spawnpoint.X) 
		local randomZ = math.random(spawnpoint.Z)
		enemy.Position = Vector3.new(randomX , 10, randomZ)
		
	end
end
 
spawnEnemies(ENEMY_COUNT)

1 comment

0

Instead of enemy.Position, try enemy:MoveTo()