Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to give players money when buying a developer product?

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.

5 comments

0

ItsJamsRBLX wdym by the developer product

0

Do you seriously not know what a developer product is? omg

0

damn thats being toxic man

0

If someone doesnt know it doesnt mean to be mad at them or be toxic

0

downvoted because you didnt bother to look in developer.roblox.com

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.