How can I duplicate the frame along with its respective Price and ImageID

  1. I am trying to create a shop from tools in a folder in ReplicatedStorage in each tool there are settings with a DamageMultiplier, its Price, and an Image I want to duplicate all of these into the frame so far I have the name down how can I get the rest

  2. Ive been trying different ways and I cant seem to understand how I can do this. I am assuming we would use a for loop but if there are any thoughts let me know

  3. I have been looking for similar issues on the Developer Forum and it did help clear up some things but I still cant seem to figure this out.

local RS = game:GetService("ReplicatedStorage")
local SG = game:GetService("StarterGui")
local Players = game:GetService("Players")
local player = Players.LocalPlayer

local Template = script.Parent.Template
local items = RS.MiningTools:GetChildren()





local dupe = function(name)
	
	
	local clone = Template:Clone();
	clone.Parent = script.Parent
	
	clone.Title.Text = name
	clone.Visible = true
	--clone.Price.Text = Price
	--clone.Image.ImageID = ""
	
end



for _, i in ipairs(items) do 
	dupe(i.Name)
end;


If anyone has any thoughts please let me know because anything will help thank you.

3 Likes

uh, you can just clone it? what is the issue, exactly?? cloning it would make the cloned part have all the same properties and descendants.

2 Likes

I’m not actually cloneing the tools but a template frame where K copy those properties on

1 Like

so, do you want there to be… like… a shop that pops up when the tool is used? what exactly is the end goal? im really confused right now.

1 Like

I have the shop set up as a pop up with a touch part and I want all the items I have in a folder in replicated storage to be on a gui template in the shop

i mean you could just make a new frame for that tool in the for loop, and there just make a new frame with the name or something? i would guess it would be kind of like this:

for i, v in pairs(items) do
   local name = v.Name
   local newframe = Instance.new("Frame")
   local newtext = Instance.new("text")
   newtext.Text = name
   -- make the offsets and whatever else you want

   newtext.Parent = newframe
   newframe.Parent =  --put reference to the gui here
end

if i understood you correctly.

Wouldn’t it be inefficient to do this because of lag and creating nre frames from script for every player?
ExplorerPageImage
I want to take everything in the MiningTools folder which contains the tool itslef along with the tool settings and make a GUI out of a gui template


I have already gotten the names to go onto the frame my question is how can I do this and add the prices and image into the frame like I did with the names

This is what i currently have

local RS = game:GetService("ReplicatedStorage")
local SG = game:GetService("StarterGui")
local Players = game:GetService("Players")
local player = Players.LocalPlayer

local Template = script.Parent.Frames.Template
local items = RS.MiningTools:GetChildren()





local duplication = function(name)
	
	
	local clone = Template:Clone();
	clone.Parent = script.Parent
	
	clone.Title.Text = name
	clone.Visible = true
	
	--local price = --??? How can I name this variable
	--clone.Price.Text = price
	 
	
end

local frames = SG.MineGUI.Shop.ScrollingFrame.Frames:GetChildren()


for eachitem, selectedItem in items do 
	local price = selectedItem.Settings.Price.Value
	duplication(selectedItem.Name)
	
	print(selectedItem.Name, price)
	
	
end;

If I can figure thia part out I might be able to work it out

--local price = --??? How can I name this variable
	--clone.Price.Text = price

would it work to move the for loop that is at the bottom to the top

why are you doing duplication(name) if you could just do duplication(tool) and then there just use the tool instance with all the values and stuff?? your logic is a tad bit weird ill tell you that.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.