I'm trying to make a game with randomized powers. I know how to make a math.random script, but it's not very efficient. For example:
local PowerMath = math.random(1,100) if PowerMath == 1 then end if PowerMath == 2 then end
I wanted to know if there is a more efficient way of making a math.random instead of having to make a script for each number. Is there a way to say if math.random == 1-50 so I don't have to make an if statement for numbers 1-50?
If I understood the question correctly, you basically want to run a specific code if the randomized number is less or equal to 50, if that is the case you can use the less or equal to sign. So:
local number = math.random(1, 100) if number <= 50 then --code end
If the number is 1, 9, 36, 40 etc.. (a number equal or less than 50) the code above will run, if that is not the case it will not.