I’m looking to sort my products by lowest robux to highest robux.
Current script
local frCashProducts = {
["10 frCash"] = {
[1] = "10 frCash", -- Name
[2] = 49, -- Price in robux
[3] = 1110641683, -- Product ID
};
["50 frCash"] = {
[1] = "50 frCash", -- Name
[2] = 249, -- Price in robux
[3] = 1110785170, -- Product ID
};
["100 frCash"] = {
[1] = "100 frCash", -- Name
[2] = 349, -- Price in robux
[3] = 1110785246, -- Product ID
};
["250 frCash"] = {
[1] = "250 frCash", -- Name
[2] = 799, -- Price in robux
[3] = 1110785314, -- Product ID
};
["500 frCash"] = {
[1] = "500 frCash", -- Name
[2] = 1499, -- Price in robux
[3] = 1110785395, -- Product ID
};
["750 frCash"] = {
[1] = "750 frCash", -- Name
[2] = 2499, -- Price in robux
[3] = 1110785496, -- Product ID
};
["1000 frCash"] = {
[1] = "1000 frCash", -- Name
[2] = 3499, -- Price in robux
[3] = 1110785596, -- Product ID
};
}
local sortedTable = table.sort(frCashProducts,
function(a,b)
return a[2] < b[2]
end
)
for i,v in pairs(sortedTable) do
print(v[1].." | "..v[2]) -- Checks the table is done correctly
end
This doesn’t seem to work and just says table expected but nil is found when printing.