PromptPurchaseFinished Not Working

I have this code From Roblox developer site but its not printing

local MarketplaceService = game:GetService("MarketplaceService")

MarketplaceService.PromptPurchaseFinished:Connect(function(player, assetId, isPurchased)
	if isPurchased then
		print(player.Name .. " bought an item with AssetID: " .. assetId)
	else
		print(player.Name .. " didn't buy an item with AssetID: " .. assetId)
	end
end)
1 Like

You sure?

image

What are you prompting? Keep in mind that game passes, products and bundles have a dedicated prompt finished event that you need to connect to. PromptPurchaseFinished does not fire if you prompt a purchase for any of those three asset types.

This thread needs more information.

1 Like

i changed to PromptGamepassPurchaseFinished But its still not working

Again, you need to provide more information otherwise we can’t help you. If you need a checklist of things that you should provide, here:

  • What type of script is this?
  • Where is the script?
  • What is the id of the item you’re attempting to prompt?
  • What is the type of item you’re attempting to prompt? Product? Game pass? Shirt? What is it?
  • How are you prompting the player? What code prompts the purchase to the player?
  • Are there any errors in your console? If so, what is the error telling you?

It is imperative that you supply details if you’re looking for help, otherwise we have limited information to go off of. We need to understand your exact circumstances.

I can recommend 2 articles from Roblox Developer site:
Game Passes

MarketPlaceService

I really don’t believe in re-inventing the wheel, as it takes too long and will never be as good as the original, so why no learn from the people who make the platform…

1- Its script
2- ServerScriptService
3- 19260946
4- Gamepass
5- A button and this local script =
script.Parent.MouseButton1Click:Connect(function(plr)
if not game.MarketplaceService:UserOwnsGamePassAsync(game.Players.LocalPlayer.UserId, 18662868) then
game.MarketplaceService:PromptGamePassPurchase(game.Players.LocalPlayer, 18662868)
end
end)

6- no errors in output

1 Like

I read all of them but i dont understand some things i’m a new developer

The ID looks different than the one you showed in the server script, unless it’s supposed to be like that.

1 Like

Right: I tried using the information you’ve supplied and it still prints for me regardless. I have a script in ServerScriptService connecting to PromptGamePassPurchaseFinished and a LocalScript that’s using the PromptGamePassPurchase code.

image

There is something fundamentally wrong in your circumstances. More information still needs to be supplied here. Try applying some debugging strategies like using prints around your code and seeing what does or doesn’t print and going off of there.

1 Like

Guys im sorry for making you busy i just forgot to change id in local script. Thank you again, bye

1 Like