Hey! Basically, I was trying to save multiple values, to be precise, 11 values.
I’m kinda new to DataStore and how to use them.
Basically, when I leave the game, it gives me this error:
" DataStore request was added to queue. If request queue fills, further requests will be dropped. Try sending fewer requests.Key = (key) "
I don’t think 11 values are a lot, but I may be wrong.
Here’s my script!
game.Players.PlayerRemoving:Connect(function(player)
--// Save the values in the Datastore
local savedValues = {}
for _, v in pairs(player.valuesFolder:GetChildren()) do
savedValues[v.Name] = v.Value
end
local success, errormessage = pcall(function()
backpackDS:SetAsync(player.UserId, savedValues)
end)
if not success then
warn("Could not save values data! "..errormessage)
else
print("Values Data Saved!")
end
--// Save the owned backpacks in the Datastore
local backpackTable = {}
for _, v in pairs(player.backpackOwned:GetChildren()) do
backpackTable[v.Name] = v.Value
end
local success, errormsg = pcall(function()
backpackDS:SetAsync(player.UserId, backpackTable)
end)
if not success then
warn("Could not save backpack data! "..errormsg)
else
print("Backpack Data Saved!")
end
end)
Thanks in advance!