I feel like there's something wrong with the local Chance. People have been reporting that the pets that are under 1% are very hard to hatch. If I make it (0,TotalWeight) I'm pretty sure it won't work. Anyone can tell me if it's broken?
function ChoosePet(Egg)
local Data = Eggs[Egg]
local Pets = Data["Pets"]
local TotalWeight = 0
for i,v in pairs(Pets) do
TotalWeight = TotalWeight + v.Rarity
end
local Chance = math.random(1,TotalWeight)
local Counter = 0
for i,v in pairs(Pets) do
Counter = Counter+v.Rarity
if Counter >= Chance then
return v.Name
end
end
end

3 comments
Try increasing the weight
I already did. I changed it to 1 and it didn't do anything, changed it to 10 and the results were the same, changed it to 100 and the eggs gained a very long cooldown between the next hatch.
The real problem is the local Chance. The math.random(1,TotalWeight) - i think what it does is starts from 1% and it's supposed to start from 0 but I can't put 0 in math.random since that won't work.