InventoryHandler script :
local Player = game.Players.LocalPlayer local Event = game.ReplicatedStorage.Events.Inventory.AddItem local Template = script.Template local ItemsFrame = script.Parent.Items local Items = ItemsFrame
Event.OnClientEvent:Connect(function(Player, ItemName) if Items:FindFirstChild(ItemName) then Items[ItemName].Quantity.Value = Player.Inventory:FindFirstChild(ItemName).Value else local NewTemplate = Template:Clone() NewTemplate.Name = ItemName NewTemplate.Parent = ItemsFrame
local ItemImage = game.ReplicatedStorage.Images.ItemsFrame:FindFirstChild(ItemName) NewTemplate.ItemImage.Image = "rbxassetid://"..ItemImage.Value NewTemplate.ItemName = ItemName NewTemplate.Quantity += 1 end
end)