I have a basic DataStore script, it's completely functional in saving tools. The only problem is that it only does it once. So if I go back in-game and grab a new tool, it will not save that tool. It's like the DataStore just stops after used once, and no longer registers any new tools.
local ds = game:GetService("DataStoreService"):GetDataStore("ToolSave") game.Players.PlayerAdded:connect(function(plr) local key = "id-"..plr.userId pcall(function() local tools = ds:GetAsync(key) if tools then for i,v in pairs(tools) do local tool = game.ServerStorage.Tools:FindFirstChild(v) if tool then tool:Clone().Parent = plr:WaitForChild("Backpack") tool:Clone().Parent = plr:WaitForChild("StarterGear") end end end end) end) game.Players.PlayerRemoving:connect(function(plr) local key = "id-"..plr.userId pcall(function() local toolsToSave = {} for i,v in pairs(plr.Backpack:GetChildren()) do if v then table.insert(toolsToSave,v.Name) end end ds:SetAsync(key,toolsToSave) end) end)
I am not asking for any scripts for DataStores, I just would like to know if there's a problem that I'm missing. I have the script in "ServerScriptService" and the tools folder in "ServerStorage."
Thank you.