Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can i make enemies spawn on random location on my part?

Asked by 4 years ago

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)
0
Instead of enemy.Position, try enemy:MoveTo() niroqeo 123 — 4y

Answer this question