How do I trigger an event on a third-party sale?

I’ve already tried using ms.PromptPurchaseFinished but this does not seem to work.

What I want it to do is trigger an event if a player bought a third-party gamepass (like pls donate).

Thanks.

2 Likes

Try

game:GetService("MarketplaceService").ProcessReceipt = function(receipt)

end

It’s a bit of a weird since callbacks are so rare on roblox, but it’s structured this way in order to allow you to return a value (to determine whether or not the transaction reward was successful before charging the player’s account)
Here’s documentation on it

1 Like

Isn’t that for DevProducts only?

You need to enable third-party sales in the security tab of the studio

1 Like

Don’t worry, I already did that…

1 Like

In that case, you just need to insert the id of the third-party item inside the prompt purchase just like how you would buy gamepasses or dev products in your games
https://create.roblox.com/docs/production/monetization/game-passes

I don’t want this event to trigger when a certain item is bought. I wan’t it to trigger every time a third-party item is bought.

Have you tried the function I sent inside the link? You need to remove the comparison inside the prompt gamepass purchase. Should fire each time a gamepass is purchased. I personally never sold a third party gamepass, so I can’t confirm this will work

What do you mean

??

and what do you mean with

There’s a function in this link (Game Passes | Roblox Creator Documentation) that shows you how to trigger an event when a gamepass is purchased. Inside the example/function they provided is comparing to see if the gamepass purchased belong to a certain ID. You mentioned you want it to prompt each time regardless of the ID. So you need to remove the comparison of the ID. And as I said before, I haven’t tried this on third-party gamepasses before, so I cannot guaranteed this method will work. Let me know if this works though.

there is no comparison

Did you check the link I sent?

Yeah I did click the link but I couldn’t find anything

Under “Prompting In-Experience Purchases” gives an example of a server-side prompt purchase function, the solution is in there. Try using that code in place of your current function

1 Like

For some reason the function I’m using right now works whenever someone purchases one of my gamepasses, but it doesn’t work for third-party passes?!?

Try using the code Roblox provides and see if that works for both in-game gamepasses and third-party gamepasses

The PromptPurchase is done via a localscript in StarterGui. (executes when butten is pressed)

Then try using the client-side script Roblox provides instead of the server-side script

Yes, roblox uses different functions for different types of purchases. They’re eerily similar and the difference between them isn’t super well documented so you might have to just do a bit of trial and error, swapping functions until one runs when you buy a third party product.

The purchase gets executed in a local script