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)

3 comments

0

please put the first code (InventoryHandler script) also in a block like you did with the second script. It is so hard to distinguish lines

0

Also small tip: Your Error is on Line 8. I just do not know which line is line 8 right now

0

give us the line 8 so we can help or elseeeeeeeeeeeeeee