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

datastore request was added to queue cant find a solution?

Asked by 3 years ago

alright so i have a script that should in theorie just make a global leaderboard onto a frame (Gui) but i keep getting the warning "datastore request was added to queue" ive tried putting a wait from 90 seconds and that don't solve it so yeah any suggestions?

local ds = game:GetService("DataStoreService")
local TimeDS = ds:GetOrderedDataStore("AdminSaveStore")


local timeUntilReset = 10


while wait(1) do


    timeUntilReset = timeUntilReset - 1

    script.Parent.Parent.Countdown.Text = timeUntilReset


    if timeUntilReset == 0 then

        timeUntilReset = 10


        for i, plr in pairs(game.Players:GetPlayers()) do

            TimeDS:SetAsync(plr.UserId, plr.leaderstats.Minutes.Value)
        end

        for i, leaderboardRank in pairs(script.Parent:GetChildren()) do

            if leaderboardRank.ClassName == "Frame" then
                leaderboardRank:Destroy()
            end
        end


        local success, errorMsg = pcall(function()

            local data = TimeDS:GetSortedAsync(false, 5)
            local coinsPage = data:GetCurrentPage()

            for rankInLB, dataStored in ipairs(coinsPage) do


                local name = game.Players:GetNameFromUserIdAsync(tonumber(dataStored.key))
                local coins = dataStored.value


                local template = script.Template:Clone()

                template.Name = name .. "Leaderboard"

                template.PlrName.Text = name

                template.Rank.Text = "#" .. rankInLB

                template.Minutes.Text = coins

                template.Parent = script.Parent             
            end         
        end)
    end
end
0
What is the error line? Xapelize 2658 — 3y
0
uh wot if u put wait(.05) before timeds setasync and check to make sure the player didn't leave while its looping so script doesn't break. BulletproofVast 1033 — 3y
0
it doesnt give an error it gives a warning so its not linked to a line "  17:10:14.721 ? DataStore request was added to queue. If request queue fills, further requests will be dropped. Try sending fewer requests.Key = 281762843 (x4)" Pitched_mobile 191 — 3y
0
Use DataStore2/ Profilservice sayer80 457 — 3y

1 answer

Log in to vote
2
Answered by 3 years ago

The warning is telling you that your DataStore request was queued, not cancelled. This usually happens when you're sending requests too quickly. Try waiting for a longer amount of time.

Useful rule of thumb: Warnings are not errors, but they do provide information that, if neglected, can lead to errors. Don't treat warnings as errors, because your code will still run if it warns you about something rather than raising an error.

0
Should also mention that the while wait() do idiom performs code upon yielding for the given amount of time, in seconds. Try changing that number. DeceptiveCaster 3761 — 3y
0
while true do causes a lot of lag for exhausted timeout script. What do you recommend? Xapelize 2658 — 3y
0
Neither makes a difference. while wait() do still runs infinitely, like while true do. It also yields for its given amount of time, which can be specified in an otherwise evident infinite loop using the wait() function. DeceptiveCaster 3761 — 3y
Ad

Answer this question