Script maybe doesn't successfully save data. It loads it in too (Maybe this is where it goes wrong), but the tools do not clone into the backpack. What is the problem?
local dataStoreService = game:GetService("DataStoreService")
local toolStore = dataStoreService:GetDataStore("TOOLS")
--local inventoryStore = dataStoreService:GetDataStore("GuiInventory")
--local backpackstore = dataStoreService:GetDataStore("Backpack")
game.Players.PlayerAdded:Connect(function(player)
local data = nil
local sucess, errormessage = pcall(function()
data = toolStore:GetAsync(player.UserId)
end)
if sucess then
if data[#data] then
for i,v in pairs(data) do
local tool = game:WaitForChild("ReplicatedStorage").Tools:FindFirstChild(data[i])
print(tool, data[i])
if tool then
tool:Clone().Parent = player.Backpack
end
end
end
else
warn("Datastore error!")
error(errormessage)
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local toolsToSave = {}
for key, object in pairs(player.Backpack:GetChildren()) do
table.insert(toolsToSave, object.Name)
end
local sucess, errormessage = pcall(function()
toolStore:SetAsync(player.UserId, toolsToSave)
end)
if sucess then
print(" ToolData Sucess!")
print(player.Name .. ",s data has been saved, its ", game:GetService("HttpService"):JSONEncode(toolsToSave))
else
warn("Datastore error!")
error(errormessage)
end
end)

8 comments
does something errors?
No, no errors
What does it prints on line 14?
lemme see
nil
it's not saving correctly
Are you testing on studio or on real game? Depending on your game configuration datastores don't work on Roblox Studio
oof, im testing on studio