As you might already know from my earlier post, I'm making an ATM machine that gives money when buying a developer product. I already scripted all 6 of the cash values that you can buy in my game but I don't know how to give the players money when purchasing it. The leaderstats and prompt is all done.
✓ ANSWER ACCEPTED
How to give players money when buying a developer product?
1 answer
✓ Accepted answer
You can use return Enum.ProductPurchaseDecision.PurchaseGranted to make sure that the player bought your DevProduct.
Example code:
game:GetService("MarketplaceService").ProcessReceipt = function(purchaseInfo)
local plr = game:GetService("Players"):GetPlayerByUserId(purchaseInfo.PlayerId) --Defines the player who bought the product
if purchaseInfo.ProductId == 828036387 then --Replace with your product ID
plr.leaderstats.Cash.Value = plr.leaderstats.Cash.Value + 1000 --Cash to be given
end
return Enum.ProductPurchaseDecision.PurchaseGranted --Makes sure the player has bought the DevProduct
end
Hope this helps!
3 comments
0
Where should I put this script?
0
Thanks it worked! I put it in ServerScriptService
0
Any time.
This discussion is preserved as it was. New answers, comments, and votes are closed.

5 comments
ItsJamsRBLX wdym by the developer product
Do you seriously not know what a developer product is? omg
damn thats being toxic man
If someone doesnt know it doesnt mean to be mad at them or be toxic
downvoted because you didnt bother to look in developer.roblox.com