Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

How to give players money when buying a developer product? [closed]

Asked by
8jxms 9
4 years ago

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.

0
ItsJamsRBLX wdym by the developer product WN0820 11 — 4y
0
Do you seriously not know what a developer product is? omg 8jxms 9 — 4y
0
damn thats being toxic man WN0820 11 — 4y
0
If someone doesnt know it doesnt mean to be mad at them or be toxic WN0820 11 — 4y
0
downvoted because you didnt bother to look in developer.roblox.com speedyfox66 237 — 4y

Closed as Not Constructive by hiimgoodpack and Torren_Mr

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 4 years ago

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!

0
Where should I put this script? 8jxms 9 — 4y
0
Thanks it worked! I put it in ServerScriptService 8jxms 9 — 4y
0
Any time. QuantumPlasmic 84 — 4y
Ad