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

Sell button is broken, GetAsync request dropped. Why?

Asked by 5 years ago

I always get the error "GetAsync request dropped. Request was throttled, but throttled request was full". The error is in line 16:

local initialSold = DS:GetAsync("P"..game.PlaceId.."M"..script.AssetID.Value)

What's wrong with it? It should be fine.

local DSS = game:GetService("DataStoreService")
local DS = DSS:GetGlobalDataStore()
local MS = game:GetService("MarketplaceService")

function OnClick(player)
    MS:PromptPurchase(player, script.AssetID.Value)
end

MS.PromptPurchaseFinished:connect(function(player, assetId, isPurchased)
    if (assetId == script.AssetID.Value) and (isPurchased == true) then
        local sold = DS:IncrementAsync("P"..game.PlaceId.."M"..script.AssetID.Value)
        script.Parent.SGUI.S.Text = "Sold here: "..sold
    end
end)

local initialSold = DS:GetAsync("P"..game.PlaceId.."M"..script.AssetID.Value)
if (initialSold ~= nil) then
    script.Parent.SGUI.S.Text = "Sold here: "..DS:GetAsync("P"..game.PlaceId.."M"..script.AssetID.Value)
else
    DS:SetAsync("P"..game.PlaceId.."M"..script.AssetID.Value, 0)
end

script.Parent.CD.MouseClick:connect(OnClick)

1 answer

Log in to vote
0
Answered by 5 years ago

It's because you're exceeding the limits on the use of Data Store calls.

Check out the limitations here: http://robloxdev.com/articles/Data-store#Limitations

Ad

Answer this question