I have three items (tools) to save and load. They are the BloxyCola, TeddyBear and the Spray. An item will be added to the player's StarterGear and Backpack if it is bought.
I want the game to save what is added to the StarterGear, then give them what they bought when they join back in.
I bought all three items . Unfortunately, when I tested it and joined the game again, the game didn't gave me the Spray! I tried a few more times, but it didn't help at all!
No errors have been stated in the output!
Here is the script:
local ds = game:GetService("DataStoreService"):GetDataStore("PlayerItems")
game.Players.PlayerAdded:connect(function(plr)
local key = "Player-"..plr.UserId
local getSaved = ds:GetAsync(key)
if getSaved then
print(table.concat(getSaved, ", ")) -- The output only printed the TeddyBear and BloxyCola.
for _, item in pairs(getSaved) do
game.ReplicatedStorage.Items:WaitForChild(item):Clone().Parent = plr:WaitForChild("StarterGear")
game.ReplicatedStorage.Items:WaitForChild(item):Clone().Parent = plr:WaitForChild("Backpack")
end
else
local items = {}
ds:SetAsync(key, items)
end
end)
game.Players.PlayerRemoving:connect(function(plr) -- I think there is something wrong in here... I'm not sure.
local key = "Player-"..plr.UserId
local items = {}
for _, gear in pairs(plr:WaitForChild("StarterGear"):GetChildren()) do
table.insert(items, gear.Name)
end
print(table.concat(items, ", ")) --Another reference... I tried in Studio and it printed all three items.
ds:UpdateAsync(key, items)
print("Player Item Save Success")
wait(2)
end)
I hope this would be enough to understand. Any help would be appreciated! :D

2 comments
Why are you using update async?
well i haven't known a lot about DataStores just yet. I hope someone will tell me the DIFFERENCE between SetAsync and UpdateAsync