Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to fix a function from getting the "Error: Request was throttled" error?

This function is a function that is used in MarketplaceService to give the player their items after purchasing the Dev Product. I keep getting the "Error: Request was throttled" error and I have no idea what is going on. In the Client side code I do have a debounce for it, but this seems like a server thing since it prints in the Server Log. Any help?

Code:

local BP_IDs = {
	[118328125] = 25,
	[118333639] = 100,
	[118341717] = 500,
	[118330826] = 1000
}

local Memb_IDs = {
	[118681940] = "OneMonth",
	[118807556] = "ThreeMonths",
	[118807670] = "SixMonths",
	[118807753] = "OneYear"
}

Marketplace.ProcessReceipt = function(info)
	local player = game.Players:GetPlayerByUserId(info.PlayerId)
	if not player then
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end
	local leads = player.leaderstats
	if info.ProductId == 52255071 then --// Add Song DevProduct ID
		Events.Music:FireClient(player, "AddSongSuccess", {"We good"})
	elseif Memb_IDs[info.ProductId] then
		PlayerInformation[player.Name].Membership.Value = Memb_IDs[info.ProductId]
		PlayerInformation[player.Name].Membership.DateCreated.Value = os.time()
		givePremiumItems(player)
	elseif BP_IDs[info.ProductId] then
		PlayerInformation[player.Name].BakerPoints.Value = PlayerInformation[player.Name].BakerPoints.Value + BP_IDs[info.ProductId]
		leads["Baker Points"].Value = leads["Baker Points"].Value + BP_IDs[info.ProductId]
	end
	return Enum.ProductPurchaseDecision.PurchaseGranted
end

2 answers

What is the problem?

When a request is throttled, that means your game has been sending too many requests to that area of the API(most commonly found in HTTP, DataStore, and Marketplace). The only way to fix it really is to slow down on how many requests your game sends some how.


How can it be stopped?

There are various things that you can do to slow down your requests to Marketplace service. For starters, you could add a 10-15 second debounce to the button/command to ensure your players aren't spamming it.


Notes

  • Quite a few developers(including myself) have been hitting the request limit a lot lately. Maybe check in with Roblox to make sure they didn't accidentally lower it or something.

  • I'll see if I can add more ideas on how to slow it down as I think of them.

  • Do note that as your game gains more players, your request limits are expanded, meaning you'll hit the limit a lot less. It's unlikely that all of those players will buy products, leaving room for the ones who do.

1 comment

0

The thing is, it doesn't work period. Like, I tried to buy it, watched the console, it repeated that warning like 8 times which shouldn't be possible as there is a 1 second debounce on the client side... I'm honestly sooo confused by this error.

Not really a scripting thing. Your sending too many requests to that key.

1 comment

0

Well, clearly. But, it shouldn't be, especially not a Marketplace thing. I even have debounces so.. and there aren't too many other ways to write a return function for ProcessReceipt

This discussion is preserved as it was. New answers, comments, and votes are closed.