I have a script that saves data of a player before the player leaves the game. Sadly, this is causing the player to lag/freeze. (I have tested when disabling/commenting this script the game runs smoothly when exiting)
I also receive this warning message:
DataStore request was added to queue. If request queue fills, further requests will be dropped. Try sending fewer requests.Key = 96373787
The script:
game.OnClose = function()
for i, v in pairs(playerdata) do
datastore:SetAsync(i, v)
end
end
I have also tried (same problems/warnings/freezing):
game.Players.PlayerRemoving:Connect(function(player)
for i, v in pairs(playerdata) do
datastore:SetAsync(i, v)
end
end)

1 comment
I didn't put it in the post, but I had already tried that, the problem still persists.