im trying to make a inventory system, and to prevent ui from duplicating if a person has multiple amounts of an item, i added an extra if statement(comment), but that if statement also breaks it. how come?
InventoryRE.OnClientEvent:Connect(function(Item)
for _, v in pairs(Player.Inventory:GetChildren()) do
if v.Name == Item.Name then
if v.Value <= 0 or v.Value == 0 then -- runs fine without, breaks with
local ItemUI = ReplicatedStorage.ItemUI:Clone()
ItemUI.Parent = InventoryFrame
ItemUI.Counter.Text = v.Value
ItemUI.Text = v.Name
ItemUI.ItemName.Value = v.Name
end
end
end
end)