How to detect whenever someone buys an item (Gamepasses, Clothing, Accessories, etc.)

  1. What do you want to achieve?
    I’m trying to make a list of players that buy an item from my game. (Any item, Gamepasses, Clothing, Accessories, etc.)

  2. What is the issue? The issue is that I’m not sure or aware of any function or event that can detect whenever someone buys an item. I don’t have an issue making or adding people to the list, the only thing I’m interested in is how to detect when anyone buys an item from my game.

  3. What solutions have you tried so far? I’ve looked for solutions on the MarketPlaceService page on the Developer Hub.

If anyone could please let me know how I can fix my issue that would be great!

1 Like

Use PlayerOwnsAsset ? Now this is what I would use for Clothing and Accessories. If you are wanting gamepasses and developer products, then Use the default methods of UserOwnsGamePassAsync and ProcessReceipt Now you might be wondering this isn’t an event, but you could pair this with PromptPurchaseFinished assuming that you prompt it in game, and check if they own these assets and things (This is just an idea)… Hope this helps?

2 Likes

Thanks a lot, I used PromptPurchaseFinished for anyone wondering. Here’s the code I used :point_down::point_down::point_down:

local MarketplaceService = game:GetService("MarketplaceService")

local function onPromptPurchaseFinished(player, assetId, isPurchased)
	print("Player has purchased an Item!")
end

MarketplaceService.PromptPurchaseFinished:Connect(onPromptPurchaseFinished)
1 Like

You will want to make sure if isPurchased == true so you can verify they actually bought it.

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