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

When the datastore i made tries to save data i get an error?

Asked by 2 years ago

So I was testing a datastore that was creating. It saves the cash in the folder in the player. I get this error every time I playtest it in the studio. It's a regular script. I tried to search up the error message. I implemented some other solutions but they didn't work. I even re-wrote the script several times. I also looked at the roblox article on data saves still didn't work.

Heres the error: ~~~~~~~~~~~~~~~~~ ``DataStore request was added to the queue. If the request queue fills, further requests will be dropped. Try sending fewer requests.

Heres the code: ~~~~~~~~~~~~~~~~~
local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("BannedAdmins")
game.Players.PlayerAdded:Connect(function(player)
    repeat
        wait(5)
    until player:FindFirstChild("Banned") and player:FindFirstChild("BanReason")
    key = "id_"..player.UserId
    savevalue1 = player.Banned
    savevalue2 = player.BanReason

    local GetSaved = DataStore:GetAsync(key)
    if GetSaved then
        wait(4)
        savevalue1.Value = GetSaved[1]
        savevalue2.Value = GetSaved[2]
    else
        local numbers = {savevalue1.Value,savevalue2.Value}
        DataStore:GetAsync(key,numbers)
    end
end)

game.Players.PlayerRemoving:Connect(function(player)
    DataStore:SetAsync(key,{savevalue1.Value,savevalue2.Value})
end)

game:BindToClose(function()
    wait(5)
end)

Answer this question