Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is the datastore telling me to send fewer requests?

Asked by
2Loos 168
2 years ago

Hi, I made a simple datastore script.

local DSS = game:GetService("DataStoreService")
local SFKDSS = DSS:GetDataStore("SFKDSS")
local SFDDSS = DSS:GetDataStore("SFDDSS")

game.Players.PlayerAdded:Connect(function(player)
    local leaderstats = player:WaitForChild("leaderstats")
    local Kills = leaderstats:WaitForChild("Kills")
    local Deaths = leaderstats:WaitForChild("Deaths")

    Kills.Value = SFKDSS:GetAsync(player.UserId, Kills.Value)
    Deaths.Value = SFDDSS:GetAsync(player.UserId, Deaths.Value)
end)

game.Players.PlayerRemoving:Connect(function(player)
    local leaderstats = player:WaitForChild("leaderstats")
    local Kills = leaderstats:WaitForChild("Kills")
    local Deaths = leaderstats:WaitForChild("Deaths")

    SFKDSS:SetAsync(player.UserId, Kills.Value)
    SFDDSS:SetAsync(player.UserId, Deaths.Value)
end)

game:BindToClose(function()
    for _, player in pairs(game.Players:GetPlayers()) do
        local leaderstats = player:WaitForChild("leaderstats")
        local Kills = leaderstats:WaitForChild("Kills")
        local Deaths = leaderstats:WaitForChild("Deaths")

        SFKDSS:SetAsync(player.UserId, Kills.Value)
        SFDDSS:SetAsync(player.UserId, Deaths.Value)
    end
end)

But when I leave the game in Studio, I get this error

22:10:53.883 DataStore request was added to queue. If request queue fills, further requests will be dropped. Try sending fewer requests.Key = 461604490

I'm not sure why, someone please explain and present a solution. Thanks!

1 answer

Log in to vote
1
Answered by 2 years ago

You are using 2 data stores. Consolidate your data in "SFDDSS" and "SFKDSS" into one larger table. The reason roblox is doing this is because you are sending too many data store requests. If you want to send fewer requests, use less data stores, simple.

0
Thank you 2Loos 168 — 2y
Ad

Answer this question