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
1 Like

This should help

Random.new() (lualearning.org)

Hello, I would be glad to help you. Can you please provide me more context?

İ am wanting add luck gamepass but. I don’t know how to make this.