13:05:55.555 - ServerScriptService.Inventory:15: attempt to get length of upvalue 'inv' (a userdata value) 13:05:55.556 - Stack Begin 13:05:55.557 - Script 'ServerScriptService.Inventory', Line 15 13:05:55.558 - Stack End
Output ^^^^
local inv = game:GetService("DataStoreService"):GetDataStore('InventoryMetricDevGalacticzy')
game.Players.PlayerAdded:Connect(function(plr)
local inventory = Instance.new("Folder",plr)
inventory.Name = 'Inventory'
local items = inv:GetAsync(plr.UserId) or {}
for i,v in pairs(items) do
if game.ReplicatedStorage.ItemValues:FindFirstChild(v) ~= nil then
game.ReplicatedStorage.ItemValues[v]:Clone().Parent = inventory
end
end
inventory.ChildAdded:connect(function(c)
inv[#inv+1] = c.Name -- error here
inv:SetAsync(plr.UserId, inv)
end)
inventory.ChildRemoved:connect(function(c)
local items = {}
for i,v in pairs(inventory:GetChildren()) do
items[i] = v.Name
end
inv:SetAsync(plr.UserId, items)
end)
end)
Script^^^
Please help it is for my game I just need a quick fix and that is all thanks :D

2 comments
I did that, no errors but it doesnt go back to my inv
never mind messed up again