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

Have I done this script correctly?

Asked by 10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

So I have done this yet I'm not sure if it has worked or not.

This is in a script in the main Workspace

local plr = game.Players.LocalPlayer
local productId = 19664507
local market = game:GetService("MarketplaceService")

CASHID = 19664516 -- Put the Developer Product ID here

Game:GetService("MarketplaceService"):PromptProductPurchase(plr, productId)
local MarketplaceService = Game:GetService("MarketplaceService")
MarketplaceService.ProcessReceipt = function(receiptInfo)
    local PointsService = Game:GetService("PointsService")
    local pointsToAward = PointsService:GetAwardablePoints()
    local universeBalance = PointsService:GetGamePointBalance(plr.userId)

    if (pointsToAward > 0 and universeBalance == 0) then
        PointsService:AwardPoints(plr.userId, 1)
    end

    return Enum.ProductPurchaseDecision.PurchaseGranted
end

This is in a Local Script on a Button GUI

local productId = 19664507 --Change this to your developer product ID!!
local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:connect(function()
    Game:GetService("MarketplaceService"):PromptProductPurchase(player, productId)
end)

Answer this question