I have looked around but all I could come up with is this, Any help?
local dataservice = game:GetService(“DataStoreService”)
local inventorydata = dataservice:GetDataStore(“Inventory”)
local itemsfolder = game.ServerStorage.ItemsFolder --replace it to the location of your item folder
game.Players.PlayerAdded:Connect(function(player)
local inventory = inventorydata:GetAsync(player.UserId) or {}
for i, si in pairs(inventory) do
if itemsfolder:FindFirstChild(si) then
itemsfolder[si]:Clone().Parent = player.Inventory–Change this to the folder you want to copy the items back into.
end
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local inventory = {}
for i, si in pairs(player.Inventory:GetChildren()) do-- Change this to the folder you want to save the children of.
table.insert(si.Name)
end
local success, errormsg = pcall(function()
inventorydata:SetAsync(player.UserId, inventory)
end)
if errormsg then warn(errormsg)
end)