How do you determine percentages for rare/common loot?

I’m making a game in which you can roll uncommons, rares, and commons of course. Let’s say rares were like 1% chance to roll. How can I check if the 1% has been selected in code, so the player gets the rare?

you can use math.random

local chance = math.random(1,100)
if chance == 1 then
--code
end

the number could be anything but thats my method

thats what i do too, what about like decimal percentages?

like would 1,1000 be considered .1%?

Yep 1,1000 would create a 0.1 chance

1 Like