Datastore Problem Again

This time its about toolsaving…
Theres no error in the output,Heres the code

local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("BackpackSave")

game.Players.PlayerAdded:Connect(function(player)
	pcall(function()
		local tool = DataStore.GetAsync("User_"..player.UserId)
		if tool then
			for i,v in pairs(tool) do
				local toolFound = game.ReplicatedStorage.Tools:FindFirstChild(v)
				if toolFound then
					toolFound:Clone().Parent = player.Backpack
					toolFound:Clone().Parent = player.StarterGear
				end
			end
			end
		end)
end)

game.Players.PlayerRemoving:Connect(function(player)
	pcall(function()
		local toolsave = {}
		for i,tool in pairs(player.Backpack:GetChildren()) do
			if tool then
				table.insert(toolsave,tool.Name)
			end
		end
		DataStore.SetAsync("User_"..player.UserId,toolsave)
	end)
end)
1 Like

When you have a Tool in your hand and leave the game, it doesn’t save it?
Or doesn’t save in both Backpack and Character

1 Like

both,Sorry for the late reply.

1 Like

try a colon, because for my datastore I used a colon and it works fine.

this bit and for the GetAsync bit, do a colon

DataStore:SetAsync("User_"..player.UserId,toolsave)
1 Like

Oops,Forgot about that…But it still doesnt work

1 Like

You are using pcall which is used to prevent errors from stopping your code from running, meaning errors will not show unless you make them. Could you try removing your pcall and print out what error occurs?

Also what is your DataStore variable set to?

2 Likes

You could try

BackpackSave:SetAsync("User_"..player.UserId,toolsave)

since you named your datastore to “backpacksave” so replace your GetAsync and SetAsync with that

1 Like

that just makes it to an unknown