Alright, so I got the saving and loading of data working for my inventory, but this one function doesn’t want to pass through the first check, and there are items in the Inventory .
local InventoryStore = DataStore2(“Inventory”, plr)
local function UpdateInventory(Default)
local tab = InventoryStore:GetTable(Defaults)
for i,v in pairs(tab) do
if Inventory:FindFirstChild(v[1]) then
print(v[1])
else
print("Adding New Item!")
local item = Instance.new("NumberValue")
item.Name = v[1]
item.Value = v[2]
item.Parent = Inventory
end
end
end
Where I set the name and the value 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
print("You already have this!")
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()
end
end
end
end)