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)
