I don't know where's my problem.
I wanted to make when player is leaving and if he have items then all items will be saved like Table in Datastore. But I'm checking DataStore that's not saving.
Code: (Server Script)
local DSS = game:GetService("DataStoreService"):GetDataStore("NewDStestq312")
local RS = game:GetService("ReplicatedStorage")
game.Players.PlayerAdded:Connect(function(Player)
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
Key = Player.UserId
local newTable = {}
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)
DSS:SetAsync(Key,newTable)
end
end
end)
Thank you if you help!

1 comment
Sorry, but nothing UH OH ;( I'm not gettiing an error