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

How Do I Make A Random Spawn Generator With My Current Code?

Asked by
zpfran -25
4 years ago
Edited 4 years ago

I am having trouble figuring out how to make a random generating spawn to spawn the drooling zombies at and here is my current code

wait(60) -- Wait 1 minute

local enemy = game.ServerStorage["Drooling Zombie"]
local spawn = game.Workspace.Spawn

while true do
    local c = enemy:Clone() -- Clone the enemy model.
    c.Parent = game.Workspace -- Parent it to the Workspace.
    c:MoveTo(spawn.Position) -- Move the enemy to the center of Spawn's position.
end

Can someone help me?

0
plz help zpfran -25 — 4y
0
use math.random() Ziffixture 6913 — 4y
0
? zpfran -25 — 4y
0
what is math random? zpfran -25 — 4y
View all comments (3 more)
0
Randomizes the chance of a number or item being chosen. killerbrenden 1537 — 4y
0
If you have a list of spawns, you can do local chosenSpawn = spawns[math.random(1,#spawns)]. This will choose 1 spawn from the table that was created. killerbrenden 1537 — 4y
0
Table zpfran -25 — 4y

Answer this question