Hi, so I am making a shop and I want only from beginning to that one specific area items to be displayed.
EX : U have starterisland and desert island ; Opening starter shop displays only starter islands items while opening desert shop displays both starter and desert one.
Here’s my tables :
local CoinTools = {
StarterShop = {
{Name = "RustyCoin", Coins = 1},
{Name = "BronzeCoin", Coins = 2},
{Name = "SilverCoin", Coins = 5},
{Name = "GoldCoin", Coins = 10},
{Name = "DiamondCoin", Coins = 25},
{Name = "EmeraldCoin", Coins = 55},
{Name = "RubyCoin", Coins = 80},
},
CandyShop = {
{Name = "VanillaCoin", Coins = 135},
{Name = "ChocolateCoin", Coins = 215},
},
EnchantedShop = {},
SpaceShop = {},
FrozenShop = {},
VolcanoShop = {},
}
Here’s my function that gets the items that’ll be displayed :
function CoinToolsModule.GetItemsFromShop(shopName)
if CoinTools[shopName] then
return -- How do I return every shop items before that one specific shop items
end
end
Thank you for reading! 
1 Like
Um hold on, can you explain more, like what you want here?
1 Like
Ok, there’s several islands and each one have a different shop(it’s only one Shop Gui though). I want it so that when opening … island shop, all items shops that are inferior to the current island shop to be displayed.
EXAMPLE :
local CoinTools = {
StarterShop = {
{Name = "RustyCoin", Coins = 1},
{Name = "BronzeCoin", Coins = 2},
{Name = "SilverCoin", Coins = 5},
{Name = "GoldCoin", Coins = 10},
{Name = "DiamondCoin", Coins = 25},
{Name = "EmeraldCoin", Coins = 55},
{Name = "RubyCoin", Coins = 80},
},
CandyShop = {
{Name = "VanillaCoin", Coins = 135},
{Name = "ChocolateCoin", Coins = 215},
},
EnchantedShop = {},
SpaceShop = {},
FrozenShop = {},
VolcanoShop = {},
}
Here, if you open the EnchantedShop, items from StarterShop, Candyshop and EnchantedShop would be displayed. I just need to get all shops that are before that one current shop.
1 Like
I’ve found the solution by implementing an hierarchy 
local Hierarchy = {
StarterShop = 1,
CandyShop = 2,
EnchantedShop = 3,
SpaceShop = 4,
FrozenShop = 5,
VolcanoShop = 6
}
Then, in the function I am adding to a table named “dataToReturn” all things before the position of the shop like that :
local Position = Hierarchy[shopName]
local dataToReturn = {}
if Position then
for i = Position, 1, -1 do
table.insert(dataToReturn, CoinTools[i])
end
end
Thank you for reading anyways!