MarketplaceService.PromptGamePassPurchaseFinished not firing?

I’ve had some strange MarketplaceService errors across my scripts tonight, and now I seem to be experiencing an issue where MarketplaceService.PromptGamePassPurchaseFinished isn’t firing after game passes are purchased in my game.

I haven’t changed anything in my game. The event suddenly no longer fires at all. I thought I’d ask if anyone else is experiencing this issue, or otherwise, what I might have done to cause this strange behavior.

Edit: in Studio “Play Solo” the purchasing works just as it should and always has. This leads me to believe that there must be some issue with the event firing, though I’ve tested it in other peoples’ games and it seems to be working. Still not sure what to think here.

There’s not enough information in this thread for me to provide an adequate response. Please post any code relevant to your issue and perhaps a screenshot of the developer console if you’re receiving any errors related to PromptGamePassPurchaseFinished.

It would also be helpful to use print statements to debug your code and see where something isn’t printing, which can also help to determine the source of your issue.

2 Likes

Here is the code:

print("Initializing PromptGamePassPurchaseFinished listener") -- prints

MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, assetId, isPurchased)
	print("PromptGamePassPurchaseFinished fired") -- never prints
	if player ~= nil and isPurchased == true then
		print("Searching for asset " .. assetId)
		local findAsset = findMatchingAsset(assetId)
		if findAsset ~= nil then
			print("Found asset")
			if findAsset.onPurchase then
				print("Calling game pass .onPurchase()")
				findAsset.onPurchase(player)
			elseif findAsset.execute then
				findAsset.execute(player)
				print("Calling game pass .execute()")
			end
		else
			print("Couldn't redeem game pass purchase- asset " .. assetId .. " not found.")
		end
	else
		print("Prompt closed without a purchase.")
	end
end)

The print at the top is running when the script runs, but the event is simply never fired under any circumstance thereafter. None of the prints are being called. The event is fired in Play Solo, though.

What is the error rate for PromptGamePassPurchaseFinished not firing (all the time/sometimes/etc)? Have you ran into any other errors regarding MarketplaceService?

The error rate is 100% of the time in production servers. I have run into another error involving MarketplaceService (Suddenly receiving error: "MarketplaceService:getProductInfo() failed because HTTP 0 (HttpError: Timedout)" - #3 by rbx_lua) but that was on the client, and it’s not happening at this time. While the above error is intermittent (or gone completely), this one is consistent.

1 Like

May I see your implementation(s) of GetProductInfo? I have the slightest inkling that the two are connected, though I have no basis for saying that. There is a very good chance you may have to file an Engine Bug Report regarding these two errors.

I decided to try to reproduce the issue, and I was able to do so on an empty baseplate game. Just like in my game, it works perfectly in Play Solo, but not in production servers.

The script is pretty much exactly like the last one, and I’m assuming that this is supposed to work:

local marketplaceService = game:GetService("MarketplaceService")

marketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, assetId, isPurchased)
	print("PromptGamePassPurchaseFinished fired.")
	print("Player: " .. player.Name)
	print("AssetId: " .. assetId)
	print("Purchase Completed: " .. tostring(isPurchased))
end)

Here’s the place: MarketplaceServiceRepo.rbxl (16.6 KB)

Obviously, if you want to see for yourself, you’ll want to create a game pass and change the Game Pass ID in StarterGui.ScreenGui.TextButton.LocalScript to test it on your own game pass as opposed to a third party purchase.

You may want to file a bug report for this then, if the event itself is not firing even on a blank baseplate. That is if one has not already been filed.

I posted it immediately after I realized that it works on an empty baseplate as well. That rules out any involvement with GetProductInfo() or anything else I’m doing in my game.

1 Like