So basically I got my Datastore working very nicely but, I don’t want items to stack in the inventory, I want them to just update the number of items they already have in the inventory, I’m not sure how to do this if anyone knows how it’d be appreciated if you helped, Thanks!
Loading Data V
local function UpdateInventory(Default)
local tab = InventoryStore:GetTable(Defaults)
for i,v in pairs(tab) do
if Inventory:FindFirstChild(v) then
else
print("Adding New Item!")
local item = Instance.new("NumberValue")
item.Name = v[1]
item.Value = v[2]
item.Parent = Inventory
end
end
end
Saving The Data V
for i,v in ipairs(Pickupables.Weapons) do
if item and item.Name == v and (item.PrimaryPart.Position - humrp.Position).Magnitude <= 5 and item then
if Inventory:FindFirstChild(item.Name) then
elseif not Inventory:FindFirstChild(item.Name) then
local Put = Instance.new("NumberValue")
Put.Name = item.Name
Put.Value = 1
print("The player has just picked up a "..item.Name)
table.insert(InventoryTable, {Put.Name, Put.Value})
InventoryStore:Set(InventoryTable)
item:Destroy()
print("Testing")
end
end
end
end)