I am trying to make a pet hatching module script and when I put in this: local chosenPet = rarityTable[math.random(1,#rarityTable)]. It said : ServerScriptService.PetMod:49: invalid argument #2 to 'random' (interval is empty). I can't figure out the problem.

8 comments

2

Your array is empty.

0

?

0

Read, buddy. Your array is empty.

0

math.random() requires a scope between two digits of either equal or greater differentials. The length operator will determine the amount of attributes within your array. If this exception is being raised, the amount of attributes—through context—is 0, I.e empty.

0

or negative :brain:

0

Wait I think I figured it out I will get back to you if it works

0

Nope

0

XD just poop LOL