I have this code to calculate a min and max for a ‘luck’ system and i want to add something where itll make a certain rarity x2 the luck like Bubble Gum Simulator.
Full code:
function SetRandomMinMax(eggToHatch)
local currentMin = 0
local currentMax = 0
for k, v in next, eggModule.Eggs[eggToHatch].Rarities do
currentMin = currentMax + 1
currentMax = currentMax + v["Chance"]
print(currentMax)
local module = require(script.Parent.LuckEvent)
if game.StarterGui.Events.x2Luck.Enabled.Value == true then
if v["Rarity"] == "Epic" or v["Rarity"] == "Legendary" or v["Rarity"] == "Secret" then
currentMax = currentMax * module.getLuck()
print(currentMax)
end
end
eggModule.Eggs[eggToHatch].Rarities[k]["Min"] = currentMin
eggModule.Eggs[eggToHatch].Rarities[k]["Max"] = currentMax
end
end
the part that adds it:
local module = require(script.Parent.LuckEvent)
if game.StarterGui.Events.x2Luck.Enabled.Value == true then
if v["Rarity"] == "Epic" or v["Rarity"] == "Legendary" or v["Rarity"] == "Secret" then
currentMax = currentMax * module.getLuck()
print(currentMax)
end
end
problem: the second rarest pet (keep in mind its 1/2 million normally.) gets hatched way to often (like every 2-4 hatches)