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 5 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.

01local ENEMY_COUNT = 25
02 
03local ServerStorage = game.ServerStorage
04 
05local function spawnEnemies(count)
06    local spawnpoint = game.Workspace.enemyspawn.Size
07 
08 
09    for i = 1, count do
10 
11        local enemy = ServerStorage.Enemies.Gladiator:Clone()
12        enemy.Parent = game.Workspace.enemyspawn
13 
14        local randomX = math.random(spawnpoint.X)
15        local randomZ = math.random(spawnpoint.Z)
View all 21 lines...
0
Instead of enemy.Position, try enemy:MoveTo() niroqeo 123 — 5y

Answer this question