Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

is it possible to do a number to another number? like from 1 to 5

I want to make a chance system, I used math.random, however I want it so when it picks the number 10, that player gets a rare item, if it gets 1-9 the player gets a common item, is there a way to do that?

1 answer

✓ Accepted answer

Try setting a variable to the random, an example:

local chance = math.random(1,10) --Creates a new variable, 'chance', and sets a random number to it between 1 and 10.
print(chance) --Tells you in Output what you got.
if chance == 10 then
--code to give the player a rare item
else
--code to give the player a common item
end

Hope I helped!

This discussion is preserved as it was. New answers, comments, and votes are closed.