Is this math broken for pet system

so i got a game and people are complaining that pet weighting system is not working under 1% here is the math for the pet system

and they are saying that no one has ever got a under 1% pet
image

No this math is correct just upper the chance

but i want pets under 1% so like 0.5%

the script is working just the chances are to hard

Does the “Chance” variable represent the percentage? If so, that could be the problem, as you’re making it “math.random(1,TotalWeight)”, meaning greater than or equal to 1, not lower.

how do i make it give pets under 1% so like 0.1%

You didn’t answer the question about the Chance variable. Does that variable represent what the percentage will land on?

Well if it is. then you’d want to do this:

local Chance = math.random(0,TotalWeight)

That will allow the number (Chance), to go from 0 up to whatever the TotalWeight turns out to be, instead of being limited to 1 as the minimum.

And, if not, then what number/variable are you using to find out which pet will be landed on?

1 Like

thanks but this wont work because math.random minimum number is 1, i used other way to fix it

Ohh okay, with vanilla lua it works that way, my bad. But glad it worked out. And make sure you mark your reply as the solution, so that the post shows up as solved, and others that need help can see the solution.

By the way, nice roblox game overall, I went and saw it. The only thing is that some of the tweening in it malfunctions, and that some of the items just cost too much robux, so people might get the impression that it’s a “cash-grab” sort of game. I do like the overall quality though, so keep up the good work in that regard. Have a good weekend!

thanks for the feedback i guess, ya i know there are some malfunctions i am trying to fix it every update