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

Why is added to queue DataStoreService not working?

Asked by 4 years ago

code:

local DSS = game:GetService("DataStoreService")
local DS = DSS:GetDataStore("Coins")

game.Players.PlayerAdded:Connect(function(player)
    local ls = Instance.new("Folder")
    ls.Name = ("leaderstats")
    ls.Parent = player
    wait(.1)
    local pts = Instance.new("IntValue")
    pts.Name = ("Rebirths")
    pts.Parent = ls
    pts.Value = 0

    local Coins = Instance.new("IntValue")
    Coins.Name = ("Coins")
    Coins.Parent = ls
    Coins.Value = DS:GetAsync(player.UserId) or 0
    wait(1)

end)

game.Players.PlayerRemoving:Connect(function(player)
    DS:SetAsync(player.UserId, player.leaderstats.Coins.Value)
end)

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

Answer this question