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