Math.random cheacking number question?

So I want to make something have a chance of happening i first tought of doing

local amountGettingItem = math.random(1,100)

if amountGettingItem <= 70 then

elseif amountItem >= 71  then -- heres the problem

elseif amountGettingItem >= 95 then

end

lets say I want one opsion to happening if the number is 20 to 60 I could put every number there but that is going to take way to long is there a way I can say if the random number is == 20-60?

Start with the highest interval and work your way down, always using the > or >= operator (you can do it the other way around too if you prefer);

if amountGettingItem >= 95 then
    --This will happen only if it's >= 95
elseif amountGettingItem > 60 then
    --This will happen if > 60 but < 95
elseif amountGettingItem >= 20 then
    --This will happen if >= 20 but <= 60
end

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