Inventory system template duplicate every refresh

Hello, I tried To make an inventory system but I came across an issue so, I want the inventory to refresh every time the player buys an item but every time the inventory refreshes the template also duplicate. How can I prevent that from happening?

1 Like

I have think for a solution for 2 days but I have nothing

Can you give your script, so we can atleast try to find where the issue is coming from?

1 Like

local plr = game.Players.LocalPlayer

for _, Item in pairs(plr.inv:GetChildren())do

local template = script.Parent.Template:Clone()
template.Parent = script.Parent
template.TextButton.Text = Item.Name

end

Is this code ran every single time a new inventory item is added?