Math.Random bug Assistance

i want to generate a random number between 1 and 100 like this

r = math.random(100,1)
but it keeps throwing: invalid argument #2 to 'random' (interval is empty) 

anybody know how to fix this?

Swap the arguments so the lower number is first.

r = math.random(1, 100)

1 Like

for some reason it returns nil now

Thats something on your part; math.random should never return nil, could you provide the full code snippet?

weird cause it returns nil i guess my studio broke or smth so imma restart and let you know if it fixes it and im very picky on sharing full code snipets ever since ai stole my code

yup that fixed it, very weird bug, tysm and sorry i wasted your time

1 Like

No worries at all, happy to help.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.