Help with Developer Product/GUI

Hello, I’m helping a friend out on how to make a GUI show a dev product popup thing when I click it and when I purchase the developer product it gives full health to the player who bought it.

I’m guessing it’s a local script and goes into a GUI.

I’m stuck on what’s going to go in this script.
Screenshot 2020-10-17 at 17.41.53

Hope y’all can help!

1 Like

Go to game settings, select monetization, create a developer product, click the … dots and then edit, you can change some placeholder name, prices, etc. After that, click the save button.

After that, create a localscript for the UI, add some stuff or whatever.

I’m a bit busy so you can read this wikia for the other parts you could do, i’m sure you’ll get it.

2 Likes

This would be a good article which I think should suit your needs.

3 Likes

First you will need to prompt a dev prduct purchase. You can do this by using MarketPlaceService:PromptProductPurchase(player, productID). The function can be called on both local and server scripts.

After that, in a normal script, we must define a function that will be called when a purchase is made.

local function processReceipt(receiptInfo)
return Enum.ProductPurchaseDecision.PurchaseGranted
end

Then, assign the function by putting MarketPlaceService.ProcessReceipt = processReceipt at the bottom of the script outside the function.

The processReceipt function will be called multiple times. If the purchase was processed then return Enum.ProductPurchaseDecision.PurchaseGranted in your function.

THE ABOVE CODE DOES NOT SAVE IF THE PURCHASE WAS GRANTED AND DOES NOT DO ANYTHING!!! It is your responsibility to give the player stuff and save data in your own datastore. I just wrote everything needed inside the function

If you want a fully functioning example script with data saving and does things or more info about scripting dev products you can find it here:

this was typed on mobile sry if it feels a bit rushed

2 Likes

Uhh, not in the energy right now, you should check these 2 wikias.

Also, don’t ask for scripts since you’d learn a little.