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

How do you make an Luck Percentage?

Asked by 4 years ago
Edited 4 years ago

So I want to make a luck percentage of giving coins for every 10 minutes but I don't understand how to make the luck percentage and also I searched into many places but didn't found any I want to make the luck percentage like the pets but here it picks random coins value.

1250 Coins - 95%
21000 Coins - 70%
32500 Coins - 50%
45000 Coins - 25%
510000 Coins - 5%

Please help me out and explain how you did it.

1 answer

Log in to vote
1
Answered by 4 years ago
01while wait(5) do--Every 5 seconds will give it a new number
02    local num = math.random(1, 100)--From 1 to 100 number will be chosen randomly
03    if num > 0 and num <= 30 then--if the number is greater then 0 but less then or equal to 30 then you get Common
04        print(num)
05        print("You get Common")
06    elseif num > 30 and num <= 60 then
07        print(num)
08        print("You get Uncommon")
09    elseif num > 60 and num <= 80 then
10        print(num)
11        print("You get Rare")
12    elseif num > 80 and num <= 90 then
13        print(num)
14        print("You get Epic")
15    elseif num > 90 and num == 100 then
16        print(num)
17        print("You get Legendary")
18    end
19end

I am not the best explainer

Ad

Answer this question