Hey there! I have an issue with a Process Receipt script. It looks like the script is almost maxing out the DataStore request when im in test mode solo. I’ll attach an image below. The UpdateAsync, GetAsync and Set & IncrementASync values are very high and its causing issues for the game. Now, my question is, how do I resolve this issue? I tried watching tutorials on DataStore but nothing seems to work, Thanks!
Image of Dev Console:
The code:
local skipID = 1137658844
local donoIDS = {
p1137291863 = 5,
p1137291861 = 10,
p1137291860 = 25,
p1137291858 = 50,
p1137291857 = 100,
p1137291856 = 250,
p1137292180 = 500,
p1137292179 = 1000,
p1137392474 = 5000,
p1137392668 = 10000,
p1137392890 = 350000
}
local cooldown = {}
game.MarketplaceService.ProcessReceipt = function(info)
local p = game.Players:GetPlayerByUserId(info.PlayerId)
if table.find(cooldown,p.Name) == nil then
cooldown[#cooldown+1] = p.Name
if info.ProductId == skipID then
p.leaderstats.Stage.Value = p.leaderstats.Stage.Value + 1
p.TeleportedStage.Value = p.TeleportedStage.Value + 1
wait(.1)
p:LoadCharacter()
else
game:GetService("DataStoreService"):GetOrderedDataStore("TopDonators"):IncrementAsync(info.PlayerId,donoIDS['p'..info.ProductId])
end
wait(1)
table.remove(cooldown,table.find(cooldown,p.Name))
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end