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

Why is my while loop not spawning zombies?

Asked by 3 years ago
Edited 3 years ago

It says that on line 5 the random interval is empty

the part1 and part 2 are max and low

local Repeatloop = 20
local Enemy = game.ServerStorage.Enemies["Red Button"]

while Repeatloop > 0 do
    local xpos = math.random(game.Workspace.Part1.Position.X,game.Workspace.Part2.Position.X)
    local ypos = math.random(game.Workspace.Part1.Position.Z,game.Workspace.Part2.Position.Z)
    local zombie = Enemy:Clone()
    local Placement = zombie.HumanoidRootPart.Position
    zombie.Parent = game.Workspace
    Placement = Vector3.new(xpos, 3, ypos)
    wait(1)
    Repeatloop -= 1
end

Answer this question