Shop system problems

A friend and I are working on a shop system that shows if you can equip, buy or if you have an item equipped. The script we have works for all items except for the 3rd bag. The scripts are in order of when they are executed.

ContainerHolder.Shop.ScrollingFrame.ChildAdded:Connect(function(child)
    if child:IsA("ImageButton") then
        child.MouseButton1Click:Connect(function()
            CurrentFrame.Value = child.Name
            
            OwnItem:FireServer(child.Name) --This event

            print(status)
            if child.Name == "starterBagbtn" then
                labelHolder.Amount.Text = "0 Coins"
                labelHolder.Capacity.Text = "Capacity: " .. 50
                BuyBtn.TextLabel.Text = "Owned"
                labelHolder.ImageLabel.Image = child.label.Image

            elseif child.Name == "unknown" then
                labelHolder.Amount.Text = "???"
                labelHolder.Capacity.Text = "???"
                BuyBtn.TextLabel.Text = "???"
                labelHolder.ImageLabel.Image = child.label.Image

            else
                
                local id
                local amount
                local max

                for m, k in pairs(Loader.ShopLoader) do
                    if k.bagName == child.Name then
                        amount = k.Cost
                        id = k.ID
                        max = k.Max
                    end
                end
                
                labelHolder.ImageLabel.Image = "rbxassetid://" .. id
                labelHolder.Amount.Text = Format.FormatCompact(amount) .. " Coins"
                labelHolder.Capacity.Text = "Capacity: " .. Format.FormatCompact(max)
            end
        end)
    end
end)
OwnItem.OnServerEvent:Connect(function(plr, containerName)
    local status = Main:CheckIfBought(plr, string.split(containerName, "btn")[1])
    OwnItem:FireClient(plr, status)
end)
function module:CheckIfBought(plr, containerName)
    local BagsFolder = plr.BagsFolder
    local Maximum = plr.stats.MaxIngredients
    local bag
    local moduleBag
    local Status



    for i, v in pairs(BagsFolder:GetChildren()) do
        if v.Name == containerName then
            bag = v
        end
    end

    for i, v in pairs(module.Bags) do
        if v.bagName == containerName then
            moduleBag = v
        end
    end

    if bag.Value and moduleBag.Max == Maximum.Value then
        Status = 'Equipped'
    elseif bag.Value and moduleBag.Max ~= Maximum.Value then
        Status = 'Equip'
    else
        Status = 'Buy'
    end

    return Status
end
OwnItem.OnClientEvent:Connect(function(sent)
    status = sent
    BuyBtn.TextLabel.Text = status
end)

BuyBtn.MouseButton1Click:Connect(function()
    BuyItem:FireServer(CurrentFrame.Value, status)
    OwnItem:FireServer(CurrentFrame.Value)
end)
BuyItem.OnServerEvent:Connect(function(plr, BagName, status)
    Main:BuyContainer(plr, string.split(BagName, "btn")[1], status)
    print(string.split(BagName, "btn")[1])
end
function module:BuyContainer(plr, containerName, status)
    local MaxIngredients = plr.stats:FindFirstChild("MaxIngredients")
    local isInfinite = plr.stats:FindFirstChild("IsInfinite")
    local Coins = plr.leaderstats:FindFirstChild("💰 Coins")

    local price
    local Max

    for i, v in pairs(plr.BagsFolder:GetChildren()) do
        if containerName == v.Name then
            local index = getIndex(v.Name)
            
            price = module.Bags[index].Cost --here
            Max = module.Bags[index].Max --here

            if status == "Buy" and Coins.Value >= price then
                Coins.Value -= price
                v.Value = true
                MaxIngredients.Value = Max
                isInfinite.Value = false
            end

        elseif status == "Equip" then
            MaxIngredients.Value = Max
        end
    end
end

We just had to change the position of the if statement on the last script.