MPS:PromptBundlePurchase breaking (after one purchase)

I made this code for a game I’m working on that prompts the player to purchase multiple free catalog items. The code keeps breaking in the bundle part of the script.

Bundle part of the code:

for i,v in pairs(tablething) do
if not game:GetService("MarketplaceService"):PlayerOwnsBundle(plr, v) then
			local done = false
			print("bundle")
			game:GetService("MarketplaceService"):PromptBundlePurchase(plr, tonumber(v))
			connection = game:GetService("MarketplaceService").PromptBundlePurchaseFinished:Connect(function(plr2, id, is)
				print("bought")
				if plr == plr and id == tonumber(v) then
					done = true
					connection:Disconnect()
				end
			end)
			repeat wait() until done
			wait(3)
		end
end

Core error:

CoreGui.RobloxGui.Modules.PurchasePrompt.Thunks.initiateBundlePurchase:54
CoreGui.RobloxGui.Modules.PurchasePrompt.Promise:29
CoreGui.RobloxGui.Modules.PurchasePrompt.Promise:32 function wpcallPacked
CoreGui.RobloxGui.Modules.PurchasePrompt.Promise:50
CoreGui.RobloxGui.Modules.PurchasePrompt.Promise:379 function _resolve
CoreGui.RobloxGui.Modules.PurchasePrompt.Promise:122 function resol  -  Client - makeConsoleImpl:79
  14:09:21.576  CorePackages.Packages._Index.Scheduler-d86ebb2a-ca453478.Scheduler.forks.SchedulerHostConfig.default:117: 
------ Error caught by React ------
provided value CoreGui.RobloxGui.Modules.PurchasePrompt.Thunks.initiateBundlePurchase:54: attempt to index nil with 'id'
CoreGui.RobloxGui.Modules.PurchasePrompt.Thunks.initiateBundlePurchase:54
CoreGui.RobloxGui.Modules.PurchasePrompt.Promise:29
CoreGui.RobloxGui.Modules.PurchasePrompt.Promise:32 function wpcallPacked
CoreGui.RobloxGui.Modules.PurchasePrompt.Promise:50
CoreGui.RobloxGui.Modules.PurchasePrompt.Promise:379 function _resolve
CoreGui.RobloxGui.Modules.PurchasePrompt.Promise:122 function resol
------ Error caught by React ------
CoreGui.RobloxGui.Modules.PurchasePrompt.Localization.LocalizationService:145 function getErrorKey
CoreGui.RobloxGui.Modules.PurchasePrompt.Components.ProductPurchase.ProductPurchaseContainer:322 function getMessageKeysFromPromptState
CoreGui.RobloxGui.Modules.PurchasePrompt.Components.ProductPurchase.ProductPurchaseContainer:439 function render
CorePackages.Packages._Index.ReactReconciler-d86ebb2a-ca453478.ReactReconciler.ReactFiberBeginWork.new:1155 function finishClassComponent
CorePackages.Packages._Index.ReactReconciler-d86ebb2a-ca453478.ReactReconciler.ReactFiberBeginWork.new:1066 function updateClassComponent
CorePackages.Packages._Index.ReactReconciler-d86ebb2a-ca453478.ReactReconciler.ReactFiberBeginWork.new:3519 function beginWork
CorePackages.Packages._Index.ReactReconciler-d86ebb2a-ca453478.ReactReconciler.ReactFiberWorkLoop.new:245
CorePackages.Packages._Index.ReactReconciler-d86ebb2a-ca453478.ReactReconciler.ReactFiberWorkLoop.new:1946
CorePackages.Packages._Index.ReactReconciler-d86ebb2a-ca453478.ReactReconciler.ReactFiberWorkLoop.new:1834
CorePackages.Packages._Index.ReactReconciler-d86ebb2a-ca453478.ReactReconciler.ReactFiberWorkLoop.new:1783
CorePackages.Packages._Index.ReactReconciler-d86ebb2a-ca453478.ReactReconciler.ReactFiberWorkLoop.new:919
CorePackages.Packages._Index.ReactReconciler-d86ebb2a-ca453478.ReactReconciler.ReactFiberWorkLoop.new:837
CorePackages.Packages._Index.Scheduler-d86ebb2a-ca453478.Scheduler.Scheduler:304
CorePackages.Packages._Index.Scheduler-d86ebb2a-ca453478.Scheduler.Scheduler:260
CorePackages.Packages._Index.Scheduler-d86ebb2a-ca453478.Scheduler.forks.SchedulerHostConfig.default:81 function doWork
CorePackages.Packages._Index.Scheduler-d86ebb2a-ca453478.Scheduler.forks.SchedulerHostConfig.default:104 function performWorkUntilDeadline
  -  Client - SchedulerHostConfig.default:117
  14:09:21.577  Stack Begin  -  Studio
  14:09:21.577  Script 'CorePackages.Packages._Index.Scheduler-d86ebb2a-ca453478.Scheduler.forks.SchedulerHostConfig.default', Line 117 - function performWorkUntilDeadline  -  Studio - SchedulerHostConfig.default:117
  14:09:21.577  Stack End  -  Studio
1 Like

Are you running this code from the client?
Try running it on the server

This issue has been resolved. Not sure when but it is now officially resolved.

Edit: I’m not sure if it was I just tried doing something.