Possible bug with PromptBundlePurchaseFinished

Since i cant post in #bug-reports i’ll just publish this here.

I just noticed that using the :Wait() method of PromptBundlePurchaseFinished in studio, it will end up in this error and break the code.

This is a recursive function im using to wait for a specific purchase to finish and then return its result to a client, im not using :Connect() since this is inside a remote event call and its easier to pass arguments.

local function waitForBundlePurchase(player: Player, bundleId: number)
	print(1)
	local client, product, purchased = MarketPlaceService.PromptBundlePurchaseFinished:Wait()
	print(2)
	
	if client.UserId == player.UserId and product == bundleId then
		return purchased
	end

	return waitForBundlePurchase(player, bundleId)
end

As you can see, print(1) runs and then the code suddently breaks giving this errors from a background script.

I think ill just bypass this with a pcall but should be fixed.

Disclaimer: I didn’t test this in-game, just in studio testing. (it already had issues when prompting a boundle a while ago)

2 Likes

You shouldn’t use :Wait, instead :Connect to when it fires. :Wait isn’t a valid method for PromptPurchaseFinished

1 Like

it actually works on PromptPurchaseFinished, but not in PromptBundlePurchaseFinished, any Event has Connect, Wait, ConnectParallel and others, i think its just a bug of the bundle event as PromptBundlePurchase() had it too a while ago

1 Like