If I understand what you’re asking for correctly, you want a shop GUI to load all of the items you want in your shop? Like, you have a folder with all of the tools you can buy, and want to automatically load them into a shop GUI.
One way to go about this is to make a prefab item slot, with information like an image, price, description, and a buy button. We can store this prefab in the script. To make sure the GUI will fill out properly and be scalable if you add more items, make the GUI a ScrollingFrame, with a UIGridLayout. You can edit the settings of the grid layout until it looks right with multiple shop items.
Along with this, you could save the information about the tool using value instances within the tool. StringValue Description IntValue Price IntValue ImageId
Then, using a for loop that would looks something like this:
local ShopItems = -- Folder with tools
local PrefabItem = script.PrefabItem
local Frame = -- scrolling frame where the items will go
for _, Tool in pairs(ShopItems:GetChildren()) do
local Item = PrefabItem:Clone()
Item.Name = Tool.Name
-- Assuming the prefab contains a TextLabel "Description", TextLabel "Price", ImageLabel "Picture", TextButton "Buy"
Item.Description.Text = Tool.Description.Value
Item.Price.Text = Tool.Price.Value
Item.Picture.Image = "rbxassetid://" .. Tool.ImageId.Value
Item.Buy.MouseButton1Down:Connect(function()
-- however you go about buying the tool
end)
Item.Parent = Frame
end
Now, since we used a grid layout, it will automatically position them into place for us!
The for loop will get every item that is in the folder. If you use a UIGridLayout, like I explained in the beginning, it will automatically fill out the positions for the items, so you don’t have to worry about scripting that part in.