#how to make the table wait

1 messages · Page 1 of 1 (latest)

river fractal
#

im trying to make a random system which will delete a value from a table and so on
then i got this output ServerScriptService.Spawning:13: invalid argument #2 to 'random' (interval is empty)
is it because all of the values in the table is deleted? and how can i make it "wait" for the value to be added in again?

#

script

local Trashcan = game.ReplicatedStorage.Folder.Trashcan
local tween = game:GetService("TweenService")

local spawnParts = {
    [1] = workspace.Part1,
    [2] = workspace.Part2,
    [3] = workspace.Part3,
    [4] = workspace.Part4
}

while true do

    local numb = math.random(1, #spawnParts)
    local part = spawnParts[numb]
    print(part.Name)
    table.remove(spawnParts, numb)

    part.Spawned.Value = true

    local clone = Trashcan:Clone()
    clone.Parent = workspace

    clone:MoveTo(part.Position)
end

its a spawning system

toxic torrent