Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
To0_ny 141
4 years ago
Edited 4 years ago

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

Log in to vote
1
Answered by 4 years ago

Try setting a variable to the random, an example:

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

Hope I helped!

Ad

Answer this question