Market Place Service Different Functions

Ello, what’s the difference between MarketplaceSerivce:PromptPurchase and MarketplaceSerivce:PromptGamePassPurchase

Also what’s the difference between MarketplaceSerivce:UserOwnsGamePassAsync and MarketplaceSerivce.PromptGamePassPurchaseFinished:Connect(function)

I’m trying to make a game pass give you a tool and I got SUPER confused on these topics. Also I want it where you instantly get the item when u purchase it.

Extra note:
Also is there anything like one of the functions will give the player a sword without the player joinning back? (idk if all of them already do that I got no clue)

MarketplaceService:PromptPurchase is used to prompt a purchase for catalog items (an accessory, shirt, pants, etc.) and library items (models, decals, audio).

MarketplaceService:PromptGamePassPurchase is used ONLY for prompting gamepass purchases.

MarketplaceService:UserOwnsGamePassAsync is used to simply just check if a player owns a gamepass.

MarketplaceService:PromptGamePassPurchaseFinished is used to detect when a gamepass purchase prompt was interacted with, and returns three variables: The player, the gamepassid, and a boolean (true or false).

Ok now I understand MarketplaceService:PromptPurchase. I got a question, can I see an example of how I would do UserOwnsGamePassAsync and the PromptGamePassPurchaseFinished? Also which one will give you an item instantly without needing to rejoin.

I’m going to be AFK, I’ll check on this post later.

PromptGamePassPurchaseFinished would give you the item instantly without needing to rejoin.
This is how to use it:

game:GetService("MarketplaceService").PromptGamePassPurchaseFinished:Connect(function(player, id, boolean)
	if boolean == true then --check if player bought gamepass
		print(player, id)
	end
end)

The function passes three arguments: the player, the gamepassid, and the boolean (whether or not the player bought it).

UserOwnsGamepassAsync just lets you check if a user owns a gamepass

game:GetService("MarketplaceService"):UserOwnsGamepassAsync(id)

Hmmm, ok… Let me try something in my script real quick.

Hmm, what should I do? Not sure what the issue is.

Wait I fixed it. Let me continue. adding characters

Would this script work for adding a tool?

local MarketplaceSerivce = game:GetService("MarketplaceService")
local GamePassID = 85228709
MarketplaceSerivce.PromptGamePassPurchaseFinished:Connect(function(Player, ID, Purchased)
	if Purchased == true then
		print("User own's gamepass")
	end
end)

The Id is already given by the arguments in the function call, so you’d only need to check if the gamepass id is what your looking for inside the function

local GamePassId = --id

MarketPlaceService.PromptGamePassPurchaseFinished:Connect(function(player, passId, bool)
   if passId == GamePassId and bool then
      --give player a sword
   end
end)
game:GetService("MarketplaceService"):PromptGamePassPurchase(54679546)

game:GetService("MarketplaceService").PromptGamePassPurchaseFinished:Connect(function(player, id, boolean)
	if boolean == true then --check if player bought gamepass
		print(player, id)
	end
end)

Use PromptGamePassPurchase and PromptGamePassPurchaseFinished together like this.

ID is already provided in the function’s argument

Ok, so I did it correctly. Now I just got to make it give the player the tool. Thanks! I’m going to mark you as a solution :slight_smile: