I'm trying to pick a random choice from this table and I keep on getting "bad argument #2 to 'random' (interval is empty)"
local animals = {['butterfly'] = {rotation = -40}, ['mouse'] = {rotation = -80}, ['sabercat'] = {rotation = -110}, ['elk'] = {rotation = -120}, ['stallion'] = {rotation = -130}, ['cow'] = {rotation = -150}, ['bear'] = {rotation = -170}, ['crab'] = {rotation = 170}, ['owl'] = {rotation = 160}, ['toad'] = {rotation = 150}, ['rat'] = {rotation = 140}, ['wolf'] = {rotation = 130}, ['cat'] = {rotation = 120}, ['lamb'] = {rotation = 110}, ['squirrel'] = {rotation = 90}, ['hound'] = {rotation = 70}, ['fox'] = {rotation = 50}, ['crow'] = {rotation = 40}, ['hawk'] = {rotation = 30}, ['spider'] = {rotation = 20}, ['snake'] = {rotation = 110}} robloxrandom = animals[math.random(1, #animals)] print(robloxrandom)
Try this,
robloxrandom = animals[math.random(#animals)]
Instead of specifying a minimum, I just put in the table length and leave it at that, and that works for me.