Issues with MarketplaceService:PromptGamePassPurchase()

MarketplaceService:PromptGamePassPurchase(player,id)
	 
MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(_,_,success)
	print(success)
	print(MarketplaceService:UserOwnsGamePassAsync(player.UserId,id))
end)

how is it possible for it to print true for success and false for the next line? success means I bought it

Maybe try adding a delay, something like this can work

MarketplaceService:PromptGamePassPurchase(player,id)
	 
MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(_,_,success)
	print(success)
	task.wait(1)
	print(MarketplaceService:UserOwnsGamePassAsync(player.UserId,id))
end)

Let me know if this works.

When I took a look at the documentation for PromptGamePassPurchaseFinished, I found this pretty important line in that parameter: “This may not accurately reflect if the purchase itself has successfully processed”. This event isn’t used to check whether a purchase has been completely processed, all it really tells you is what the user did when they were prompted with the gamepass

EDIT: sorry for not actually giving the solution, I forgot to add that using UserOwnsGamePassAsync() is the actual way to check whether the purchase was processed

that doesn’t make a difference

that makes sense, but why doesn’t the purchase work?

Honestly, that’s the only part I can’t immediately answer. My best guess is that it could be down to Roblox Studio with the way it handles purchases in testing, as you technically never purchase the item. Try to see if you can get this method to return true in a live server.

but I would need to pay robux in a live server

you should already own your game passes if you’re the one who created them unless im wrong

in order to test buying them, I would need to delete them from my inventory

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