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

Confirm in game purchase?

Asked by
NotSoNorm 777 Moderation Voter
9 years ago

Alright, So I'm trying to get this script to add points to a leaderboard but how do I confirm that they bought the item and how do I add to the leaderboard?

local Id = script.Parent.ID.Value 
local player = game.Players.LocalPlayer

function onClick() 
Game:GetService("MarketplaceService"):PromptPurchase(player, script.Parent.ID.Value, false, 0) 
end

script.Parent.MouseButton1Click:connect(onClick)

1 answer

Log in to vote
0
Answered by 9 years ago

You can use the PromptPurchasedFinished event.

Server script:

Game:GetService("MarketplaceService").PromptPurchaseFinished:connect(
function(Player,Id,Purchased)
    if Purchased then
        if Id == 3 then
            --Do stuff
            Player.Character:BreakJoints()
        elseif Id == 32 then
            --Stuff
        end
    end
end)
Ad

Answer this question