Hello. I’ve recently been utilizing an open-source inventory made by @Trix_set the post can be found here: Open Sourced Inventory System . Everything seems to work fine except for this one issue where you aren’t able to pick up any items after you reach the full weight capacity. I believe the code handling that would be this:
local function AddToSlot(item, userId)
local tempData = TempDatas[userId]
local data = Datas[userId]
local itemInfo = ItemsInfo[item]
if (tempData.Weight + itemInfo.Weight) > data.MaxWeight then
print("not enough max weight")
return false
end
if itemInfo.Stackable then
for _, v in pairs(tempData.Slots) do
if v.Item == item then
if v.Amount < itemInfo.StackCap then
v.Amount += 1
tempData.Weight += itemInfo.Weight
return true
end
end
end
end
if #tempData.Slots < data.MaxSlot then
table.insert(tempData.Slots, {Item = item; Amount = 1})
tempData.Weight += itemInfo.Weight
return true
else
print("not enough slots")
end
return false
end
I’ve tried messing around with the code but I’m unable to figure out how to fix this issue. The rest of the code can be found on the post. Any help would be appreciated!