Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

why is this DataStore always full?

this is a code datastore, and it always gives me this error after someone redeems a code

DataStore request was added to queue. If request queue fills, further requests will be dropped. Try sending fewer requests.Key = stats295595864

local data = game:GetService("DataStoreService"):GetDataStore("savedcodes")
    local ss = game:GetService("ServerStorage")
    local activated = {}
    game.Players.PlayerAdded:Connect(function(player)
        local key = "codes-"..player.userId
        local folder = Instance.new("Folder",player)
        folder.Name = "Codes"
        local save = data:GetAsync(key)
        if save then
        for i = 1, #save do
            local temp = Instance.new("BoolValue",folder)
            temp.Name = save[1]
            end
        end
    end)
    game.ReplicatedStorage.Remote.Redeem.OnServerEvent:Connect(function(player,code)
        local reward = player:FindFirstChild("leaderstats")
        local r = reward.Coins
        local key = "codes-"..player.userId
    player.PlayerGui:WaitForChild("MainGui"):WaitForChild("Code")

        if code == "Code1"  then
        if player.Codes:FindFirstChild(code) == nil then
        local bool = Instance.new("BoolValue")
        bool.Parent = player:FindFirstChild("Codes")
        bool.Name = code
        r.Value = r.Value + 300
    player.PlayerGui:FindFirstChild("MainGui").Code.TextBox.Text = "Redeemed!"
    wait(2)
    player.PlayerGui:FindFirstChild("MainGui").Code.TextBox.Text = ""
        else
        player.PlayerGui:FindFirstChild("MainGui").Code.TextBox.Text = "Already Redeemed!"
        wait(1)
        player.PlayerGui:FindFirstChild("MainGui").Code.TextBox.Text = ""
    end
    end

        for i,v in pairs(player.Codes:GetChildren()) do
            if v:isA("BoolValue") then
                table.insert(activated, v.Name)
                data:SetAsync(key,activated)
            end
        end
    end)

    game.Players.PlayerRemoving:Connect(function(plr)
        data:SetAsync("codes-"..plr.userId, activated)
    end)

4 comments

0

You need to throttle your data saving. If someone joins the game right on top of you, or you make a request to the same key within 6 seconds, it will throttle the request.

0

how do I do that? should I use pcall?

0

The DataStore request was added to queue. If request queue fills, further requests will be dropped. Try sending fewer requests

0

thats fine unless its an error which then the data doesnt save, u should be fine

1 answer

that just means there's code that's calling datastore functions - such as GetAsync, SetAsync, or UpdateAsync, etc very frequent... try calling these functions as minimal as you possibly could.. retrieve data and change it then save it only when you have too, such as when the player is leaving the game, or game is shutting down...

This discussion is preserved as it was. New answers, comments, and votes are closed.