I have been researching for hours and I can’t seem to make “math.random()” or “Random.new()” to not go to 0 easy. I am trying to find a way to do a luck system without it getting at least < 5 easy without any luck.
Don’t know if this would help at all, but it seems like you’re going for a pet simulator type of game.
Try looking up some uncopylocked simulator games and take a check into their egg code, that’s how many coders get help with their coding. How ever this may not be for everyone, so a Youtube tutorial could help.
As I mentioned I have researched for hours on youtube and devforum and tried many other ways but in all of the ways I’ve tried I keep getting to 0 - 1 really easy in just a couple times looping
When I do math.random(100) or using the random.new I always get close to 0 every couple of times printing in the command line (which will be same in game) I want to find a way to make it harder to get close to 0 without gamepasses (basically free to play) and easier with luck (pay to win)
If you want to include decimals in your math.random, do the following.
local Roll = math.random(1,1000)/10 -- This will get .0 decimals.
local Roll = math.random(1,10000)/100 -- This will get .00 decimals.
local Roll = math.random(1,100000)/1000 -- This will get .000 decimals.
If you want to include a luck gamepass, then you could do something like this.
local Roll = math.random(1,10000)/100 -- This will get .00 decimals.
-- Roll is in this case 30.16
if DoubleLuckGamepass then
Roll/2
end
-- Roll is now 15.8
Well, you should not avoid this. There is only 1/100 chance that it prints 3 exactly, and 3/100 chance that it prints 3 or anything below. If you manipulate the outcome of the math.random, to do so higher numbers is more likely, then it’s not a %-chance any longer. Instead you should set your rarities to something lower, if you wish that they become more rare.
If you use this sample
local Roll = math.random(1,10000)/100 -- This will get .00 decimals.
Then the chance of hitting 0.03 is 1/10000, and that number or anything below is 3/10000.