When I leave with a tool in my inventory and join back it simply does not give me the tool
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)
Okay so this answer is a bit easier than I originally thought. I was using this script also, a friend of mine originally wrote it and I was having the same problem as you.I was driving myself crazy trying to figure out what was going wrong and why it wouldn't save tools upon coming back into the game.
What I figured out was that I had API services enabled in Roblox Studio and for some reason or another it was messing with the datastore whenever I went into studio and edited the script or played it in studio. After I unchecked enable API services it started working 100% better.
I hope this helps you. I know it helped me.