Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

invalid argument #2 to 'random' (interval is empty)?

Asked by
pilotly 15
9 days ago

Hello. Im new to tables and im trying to make a system of a random number being pulled from a table but i get the error. " invalid argument #2 to 'random' (interval is empty)". Any help is thankful.

local lengths = {
    Short = 100,
    Medium = 500,   
    Long = 1000
}

local length = math.random(1,#lengths)


while wait(2) do
    print(lengths[length])
end
0
Exclude the dictionary references. Ziffixture 5633 — 9d

Answer this question