Datastore request was added to queue, when buying product?!?!

Recently i made a system in my game that gives you a clue on where to find a certain object, it always worked but now my players are reporting that it doesnt work anymore…
This is the error that it gives when you purchase a clue:

The only problem is that the process receipt doesn’t access any datastore at all…
It just popups a UI when the product is purchased!
Any help will be appreciated!

maybe there is a function that saves to datastore that you bought the product?
Try looking for “SetAsync” in the Find All thing

Nope there is no setasync

(30 chaars)

This usually happens when you’re sending too many data store requests within a certain amount of time.

Sorry, but the only datastore request is when a player leaves the server. I still have the problem that the product purchases get queued and players don’t receive the reward that they paid for it…
Does anybody know a fix?

The warning message is a datastore queue warning, and all it means is that it’s going to fulfill the request later, not that it gets dropped completely. I’d start by looking for where you’re calling ProcessReceipt in your code and trace it to the datastore. Also, if you have more than one ProcessReceipt function in your entire codebase, that could be another issue too.

1 Like

Alright, but if it’s going to fulfill the purchase later, how does it not give the player the reward later? I tried to put a print function in the process receipt, but it seems like it just doesn’t detect the purchase.

By the way, I only have one processReceipt script, BUT, I do have a function related to product purchases which is PromptProductPurchaseFinished. This is used to detect if the player actually buys a thing, otherwise if not. bought it will delete a part in the workspace.
Do I have to delete that?

1 Like

It dosent ever reach the processReceipt function at all? Example below of what I mean vvv

local function processReceipt(receiptInfo)
	print("makes it here")
end

MarketplaceService.ProcessReceipt = processReceipt

If your code doesn’t print here, are you maybe possibly using gamepasses instead of devproducts?

This is what it’s used for: (in STUDIO it works, but in GAME it doesn’t work)

Basically when you click buy item it makes a string value with the player’s user id and the item he wants to buy. When it detects the process receipt it gives him the item and deletes the string value…
Although I don’t understand why it doesn’t work in game, but on studio it does work…
here’s the process receipt code:

local ms = game:GetService("MarketplaceService")
local sunshines = require(game:GetService("ServerScriptService").Sunshines)
local idBuySunshine = 1817633295

local bs = game:GetService("BadgeService")

local function processreceipt(receiptInfo)
	local userId = receiptInfo.PlayerId
	local productId = receiptInfo.ProductId
	
	if productId == idBuySunshine then
		local s = game.ReplicatedStorage.BuyingSunshines:FindFirstChild(userId.."-Sunshine")
		local sunshine = sunshines[s.Value]
		local badge = sunshine.badge
		local plr = game.Players:GetPlayerByUserId(userId)
		
		
		local str = Instance.new("StringValue", plr.Sunshines)
		str.Name = s.Value
		str.Value = s.Value
		
		print(plr.Name.." bought the product: "..s.Value)
		s:Destroy()
		bs:AwardBadge(plr.UserId, sunshine.badge)

		game.ReplicatedStorage.AwardSunshine:FireClient(plr, sunshine, s.Value)

		 
		
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
	
	
end


ms.ProcessReceipt = processreceipt

Maybe it’s because all the times it checks if the player has the badge? Maybe that’s the datastore request?

1 Like

Might be silly, but I noticed you’re doing it on the client? When you opened the console to the client, it printed the line of code there. You should be doing this on the server

image

The processReceipt script is on the ServerScriptService…
The script that prompts the product purchase is also a script…
Screenshot 2024-05-24 alle 10.58.58
Screenshot 2024-05-24 alle 10.57.59

Do you know if that’s the problem?

1 Like

To fix your original problem I recommend you go through every script and find every line where a function from the DataStores is called. The error message you are getting implies that you’re exceeding the DataStores requests per minute limit and Roblox is saving API calls until the ratelimit refreshes. The DataStores limitations can be found on the associated docs page. You’ll have to go over your implementation and find the script that is sending too many DataStore requests.

As a sidenote, I also recommend you bypass using value instances for your purchase system. It is overly complex to save the product a player wants inside of a value instance. I recommend you only go off of the ProductId given in the receiptInfo parameter. If you’re handling multiple products over a single product id it’s worth it to create a new developer product for each one.

Hi!
So the only code that access the datastores is the leaderstats script. When a player joins it gets async and when he leaves it sets async…
Although in my datastore console tab i see that every second the values GetAsync, UpdateAsync eand Set & Increment Async increase by one… I don’t know what they’re caused by…


If i search for a certain script that uses datastores i only find my leaderstats…

And this problem is only in one of my games… All of my other games do not have this kind of problem!

Excuse me, do you have by any chance a solution? I’m in desperate need to fix this, my players are really angry for not getting their rewards…

(I can pay you if you solve it)

I’ll gladly help you but can you provide the script that’s actually calling GetAsync and SetAsync? It’s hard for me to find a solution without the code that you’re having problems with. As a sidenote, in case something like this happens again in the future it’s generally a good idea to log player purchases in a separate DataStore so you can provide people refunds or award items manually. Alternatively you can also use something like this free proxy service for Discord webhooks to log player purchases in the future.

1 Like

Hey!
I managed to put a webhook connected to the process receipt and the databases changes (I didn’t use the free proxy) and I found the problem!
As another user said previously there was a free model donations leaderboard (I didn’t have time to make a proper one) that was requiring an external module script. I imported that and there was another process receipt function that was changing a data store value too fast!
The solution was just deleting the dono leaderboard and make one by myself.

Thank you all for the awesome answers!

And for who’s having my same problem, be careful with free models that require external scripts!
example:

local moduleScript = require(164829291)
3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.