Hello everybody! So i’m trying to do this where if an item is bought, if a key with the same name of it doesn’t exist in the player’s table, it will create a it and how much the player has of the item as the value. If it does, it just adds 1 to the value.
for i, item in pairs(inv) do
if item == name then
inv[name] += 1
else
inv[name] = 1
end
end
It seems to be working if there is no key of the item, but doesn’t add by 1 at all if the key does exist. How do i make it so that it does add by 1?