Alright here’s what I did and it seems to work now:
local InventorySystem = require(script.Parent.InventoryService)
local Inventories = {}
game.Players.PlayerAdded:Connect(function(Player)
local Inventory = InventorySystem.new(nil, Player)
Inventories[Player] = Inventory
end)
game.Players.PlayerRemoving:Connect(function(Player)
for i,v in pairs(Inventories[Player]) do
print(i,v)
end
end)