Hi, im making an inventory system which stores its data in a folder and reloads the data from it every time a new item is collected, however, the frame is distorted and the other items dont show except the newest one
script
local items = require(game.ReplicatedStorage.Items)
local template = game.ReplicatedStorage.Template:Clone()
game.Players.PlayerAdded:Connect(function(plr)
local plr_inventory = Instance.new("Folder", game.ReplicatedStorage)
plr_inventory.Name = plr.Name
local temp = game.ReplicatedStorage.Template
game.ReplicatedStorage.Cases.BuyCase.OnServerEvent:Connect(function(player, unboxed)
local item = Instance.new("Folder", plr_inventory)
item.Name = items.Items[unboxed].name
local image = Instance.new("ImageLabel", item)
image.Image = "rbxassetid://"..items.Items[unboxed].imageID
local price = Instance.new("NumberValue", item)
price.Value = items.Items[unboxed].price
player.PlayerGui.ScreenGui.background.inventory:ClearAllChildren()
task.wait(0.1)
for i, v in pairs(game.ReplicatedStorage:FindFirstChild(player.Name):GetChildren()) do
local tempclone = temp:Clone()
tempclone.Parent = player.PlayerGui.ScreenGui.background.inventory
tempclone.Name = v.Name
tempclone.ImageLabel.Image = v.ImageLabel.Image
end
end)
end)