I'm tried to make inventory save and when player leaving creating new table with items. But this is not saving
I'm not getting an error
Code: (Server Script)
local DSS = game:GetService("DataStoreService"):GetDataStore("NewDStestq312") local RS = game:GetService("ReplicatedStorage") game.Players.PlayerAdded:Connect(function(Player) local Key Key = Player.UserId local Folder = Instance.new("Folder",RS) Folder.Name = Player.Name.."-Inventory.UID-"..Player.UserId local getData = DSS:GetAsync(Player.UserId) if getData then print("Test") end end) game.Players.PlayerRemoving:Connect(function(Player) local Key local newTable = {} Key = Player.UserId local findData = RS:FindFirstChild(Player.Name.."-Inventory.UID-"..Player.UserId) if findData then for i,v in pairs(findData:GetChildren()) do local findNames = v.Name table.insert(newTable,findNames) end wait() DSS:SetAsync(Key,newTable) end end)