This inserts the pets chance into a table where it will get a random one. The chance is the number next to the pets name (Code Block 2 for the module/pets)
local canGetPets = {} local rar = eggModule[egg].Rarities for currentPlace = 1,#rar do local mathmatical = math.max(rar[currentPlace][2]) for i = 1,mathmatical do table.insert(canGetPets, rar[currentPlace][1]) end end
(Egg module script with pets and their chance)
local eggs = { ["Basic Egg"] = { Cost = {"Cash", 0}; Rarities = { {"Dog", 55}; {"Cat", 45}; {"Bear", 30}; {"Wolf", 15}; {"Vespertillius", 0.002}; } }; } return eggs
The problem is is that it can't insert 0.002 of a pet into a table (obviously) I just don't know how else to do it.