DataStore request was added to queue

So i have this function saving players characters as they leave the game, but when i try it out in studio my studio hangs for like 10 seconds and then returns this warning:

How would i be able to fix this? any help is appreciated!

local function playerRemoving(player)
	local _characters = {}
	
	local succes, err = pcall(function()
		
		for i,v in pairs(player.CharacterShop.Characters:GetChildren()) do
			table.insert(_characters, v.Name)
		end
		
		datastore:SetAsync(player.UserId.."Characters", _characters)
	end)
	
	if succes then
		print("Succes!")
	else
		warn("Error")
	end
end
1 Like

Do you have any other places that could be saving datastores? Look for :SetAsync and :UpdateAsync using FindAll (Ctrl+Shift+F)

1 Like

No this is the only one using it

Try putting task.wait() on top of

maybe it can fix your problem

1 Like

Im not getting the error anymore, thanks!

Just asking, would a task.wait(1-2-3) also give it more time to save?

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.