Help With Dev Products

im currently making a game where basically a event happens if someone donates from a dev product. but i dont know how to create the script that basically says “if player donates then”, does anyone know how i can make a line of code trigger if someone buys a dev product???

Hi,
try this:

local mps = game:GetService(“MarketPlaceService”)
local productId = “your ID here”

function processReceipt(receipt)
if receipt.ProductId == productId then

“do your stuff here”

end

mps.ProcessReceipt = processReceipt

image
image

You would need to use the callback from the purchase of the DevProduct. The callback is called “processReceipt”. Once got the call back you just use the values given to you from Roblox for example the user who purchased the product and what the product ID is. Just something else to add, you want to ensure that when you get the call back you use the Enum of “ProductPurchaseDecision” to either say if the purchase was successful or not. If you don’t tell Roblox via “ProductPurchaseDecision” Enum if the DevProduct stuff was completed then I believe Roblox auto refunds the user after a few days.

More information about it (and also a better explanation of how to use DevProducts) can be found here:

Also a link to the Enum ProductPurcaseDecision:

https://developer.roblox.com/en-us/api-reference/enum/ProductPurchaseDecision

1 Like