How to make a Strong DataStore

local success, responce 
local count = 0
game.Players.PlayerAdded:Connect(function(plr)




repeat
		
		if count >=1 then
			warn("Retrying")
			wait(7)
		end
			success, responce = pcall(DataStore.GetAsync, DataStore, "MyDataStore")
			count = count + 1
		until success
	
		for _, toolName in pairs() do

			local tool = game.ReplicatedStorage.ToolsSaved:FindFirstChild(toolName)

			if tool then
				local newTool = tool:Clone()
				newTool.Parent = plr.Backpack

				local newTool = tool:Clone()
				newTool.Parent = plr.StarterGear

			end
		end
	end	
end)
game.Players.PlayerRemoving:Connect(function(plr)

	local toolsTable = {}

	for _, tool in pairs(plr.Backpack:GetChildren()) do
		if game.ReplicatedStorage.ToolsSaved:FindFirstChild(tool.Name) then
			table.insert(toolsTable,tool.Name)
		end
	end


	local success, errorMessage = pcall(function()
		DataStore:SetAsync(plr.UserId,toolsTable)
	end)

end)

game:BindToClose(function()
	for _, plr in pairs(game.Players:GetPlayers()) do
		local toolsTable = {}

		for _, tool in pairs(plr.Backpack:GetChildren()) do
			if game.ReplicatedStorage.ToolsSaved:FindFirstChild(tool.Name) then
				table.insert(toolsTable,tool.Name)
			end
		end


		local success, errorMessage = pcall(function()
			DataStore:SetAsync(plr.UserId,toolsTable)
		end)	
	end
end)

You can cache a DataStore for each user while they’re in game and save it when they leave. That way you can make as many transactions to the cached data as you like without actually interacting with the DataStoreService itself.

Just store a table where the key is the Player and the value is their data to save when they join. Once they leave the game, then save to their DataStore key and remove their data from your cache.

Don’t forget to save everyone’s data (who is still left in the cache) when the game shuts down. This is basically how these DataStore modules work.

DataStore:UpdateAsync() can also be used to retrieve data, doesn’t matter.

Also, why are you using pcalls if you are not going to utilize the error message if there is one?

Do you not know how a pcall works? GetAsync or UpdateAsync are asynchronous functions, hence the Async at the end of their name. They send a GET HTTP request to retrieve the data from an API which will yield the current thread until there is a response from the API, there is none, it returns nil.

Asynchronous functions should always be wrapped in a pcall since they are prone to failing. The main purpose of a pcall is to prevent the script from breaking if there is an error on the function you pcall, not for checking any errors but should.

DataStore:UpdateAsync() can be used to retrieve data, but it is meant to update the old data with new data.

I know how a call works; he was not handling the errors if there were any.

I know how a call works; he was not handling the errors if there were any.

He is wrapping the data call into a pcall which is my point here and yes, he should handle the errors if there were any returned by the pcalled call. However that doesn’t prove your point that he was using pcalls unnecessarily as by your post:

why are you using pcalls if you are not going to utilize the error message if there is one?

So was I not doing it correctly?