while true do local luck = math.random(1,100) if luck == 1 then print ("Very Lucky!") elseif luck == 2 -- how do i make it range from 2 to 50??? i don't want to waste my time doing == 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or...
For a range you can use the "greater than" (>, >=) and "less than" (<, <=) symbols, and the "and" word.
The "and" makes sure that all of the situations in the if
statement are correct.
This is an example for checking if a number is between 2 and 50, including 2, excluding 50:
if luck >= 2 and luck < 50 then -- If luck is greater than or equal to (>=) 2, AND luck is less than 50, then... end
If you also want to include 50 you can also put a <=
instead of <
there.
On a side note, I see that this is inside of a while true do loop. Make sure you put a wait()
inside of the loop to avoid your studio freezing and crashing.