Luck Gamepass Help

  1. What do you want to achieve?
    I’d like to make it so that players with a certain gamepass get better chances at egg hatching (3x better).

  2. What is the issue?
    I’m not sure which one of the solutions I currently have is better.

  3. What solutions have you tried so far?
    The Chance variable is a random value from 1 to the Weight of the Egg.
    I have 3 solutions that I’ve tried:

1st Solution: If they own the gamepass, they get their chance selected randomly from (1,Weight/3), the lower values being the rarer pets.

This is the function that I use for this solution. Here Pets has been made into an Array from the Dictionary, so that I can sort it from rare to common rarities. The Array has the weights for each pet, for example the rarest pet has the weight 1 and the most common one has the weight 40.

for i,v in pairs(Pets) do
	TotalWeight = TotalWeight + v[1]
end

local function ChoosePet(Player)
	local Chance
	if isLucky == false then
		Chance = math.random(1,TotalWeight)
	else
		Chance = math.random(1,TotalWeight/3)
	end
	local Counter = 0
	for i,v in pairs(Pets) do
		Counter = Counter+v[1]
		if Chance <= Counter then
			return v.Name
		end
	end
end

2nd Solution: Use the normal chance but use the choosing function 3 times and then give the best pet of the 3.
3rd Solution: The rare pets get their weight multiplied with 3 so they are hatched more often.
Basically in this one I’ll just do this:

for i,v in pairs(Pets) do
	TotalWeight = TotalWeight + v[1]
	if v[1] <= 20 then
		TotalWeight += 2*v[1]
	end
end

I haven’t written any code for the other 2, but it’s fairly simple to.
In case none of the solutions I’ve thought of are good, please suggest me one.

It’d sure be helpful if we can see any attempted code so we can identity the problem or narrow the path for you. Otherwise, we’re running on baseless assumptions.

What code or script have you tried

I’ve updated it with the code from the first solution I’ve tried. The other 2 are just some ideas that I thought of, they’re fairly simple to do. I only care which one would work the best to increase the chance by 3 times. If none of them do, please suggest me one that would.

1- Create a table including every pet’s name like this: {“noob”, “good boi”}
2- now have a loop over the rare pets you want the increase the chance at hatching and add them to the same table again 2 times, if we say noob pet is rare then it should look like this {“noob”, “noob”, “noob”, “good boi”}
3- select a random value in the table
4- done

So basically my 3rd solution right?

Probably not, just go ahead and try it, it has to work.