Hello,
Im working on inventory data and i ran into problems…
So there is table that holds more tables (or items), each item table has 2 values, Name ([1])
and Count ([2]), Count is number, when i try to do math with it it returns back to its original value (5)
code that controls subtraction:
script.Parent.LocalSEvents.InventoryRemove.Event:Connect(function(itemNum)
local itemRemoved=inventory[itemNum]
if itemRemoved~=nil then
local name=itemRemoved[1]
local numberLeft=itemRemoved[2]
if numberLeft > 0 then
game.ReplicatedStorage.Drop:FireServer(itemRemoved[1])
numberLeft=numberLeft-1
print(numberLeft)
end
if numberLeft == 0 then
print("empty")
script.Parent.LocalSEvents.InventoryFeedBack:Fire(true,itemNum,nil)
table.remove(inventory,itemNum)
end
end
end)
Can someone tell me why is this returning Count value?