#how do i return the module.ingredients?

1 messages · Page 1 of 1 (latest)

errant mountain
#

i want the number after the ingredient to be the luck boost

#
local module = {}
local food = script.Parent.Parent.Parent.Parent.Food
local luckboost = nil
local total = math.random(1, 172)
module.food = {
    ["6"] = food.Waffle,
    ["5"] = food.DarkPoisonPizza,
    ["4"] = food.Burger,
    ["3"] = food.Donut,
    ["2"] = food.Pizza,
    ["1"] = food.Chocolate,
}

module.rarities ={
    ["6"] = 1,
    ["5"] = 1,
    ["4"] = 50,
    ["3"] = 19,
    ["2"] = 51,
    ["1"] = 50,
}

module.prices = {
    [6] = 20000,
    [5] = 10000,
    [4] = 1000,
    [3] = 300,
    [2] = 100,
    [1] = 85,
}

module.ingredients = {
    ["Tomato"] = 2,
    ["Egg"] = 1,
    ["Butter"] = 1,
    ["Ice cubes"] = 1,
}

module.ChooseFood = function()
    if luckboost then
        local random = total * luckboost    
    else
        local random = total
        local counter = 0

        for rarity, weight in module.rarities do
            counter += weight
            if random <= counter then
                local price = module.prices[tonumber(rarity)]
                return module.food[rarity], rarity, price
            end
        end
    end
    end


return module
#

how do i define the luckboost?