#my module script returns every price in the table

1 messages · Page 1 of 1 (latest)

drifting sand
#
local food = script.Parent.Parent.Parent.Parent.Food

module.food = {
    ["5"] = food.DarkPoisonPizza,
    ["3"] = food.Pizza,
    ["2"] = food.Chocolate,
}

module.rarities ={
    ["5"] = 1,
    ["3"] = 19,
    ["2"] = 80,
}

module.prices = {
    ["5"] = 10000,
    ["3"] = 300,
    ["2"] = 85,
}

module.ChooseFood = function()
    local random = math.random(1, 100)
    local counter = 0

    for rarity, weight in module.rarities do
        counter += weight
        if random <= counter then
            return module.food[rarity], rarity
        end
    end
end

module.findprices = function()
    local total = 0
    for rarity, price in module.prices do
        print("Rarity: " .. rarity .. ", Price: " .. price)
        total += price
    end
    return total



end


return module
#

any help is appreciated

wide zinc