How to make chance system with luck?

How to make chance system with luck?

This chance system but not with luck.

function(PrizeTable)
	local totalweight = 0
	for _ , Data in PrizeTable do
		totalweight += Data.Chance		
	end
	
	local Chance = math.random(1,totalweight)
	local Counter = 0
	
	for i , Data in PrizeTable do
		Counter += Data.Chance
		if Chance <= Counter then
			return Data
		end
	end
end
2 Likes

Well I am not sure if mine is good either, but what I have tried is loop from the best to worst and with a random number it should get selected WHEN the random number is 1. So basically if we have Rare 1/25 and the math.random(1,25) says 1, it gets selected.

I don’t recommend adding artificial luck, as there is already built in luck which is just the amount of weight you put on each prize.

But if for some reason you wanted to add more luck, you could just randomly change the weights of each prize.


The system you have now looks pretty good to me. Also beware, if the system involves Robux you have to abide by random items policy