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

Player Point help????

Asked by 10 years ago
local productId = 19874388 
local player = game.Players.LocalPlayer

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

It wont work when trying to insert 2 playerpoints into the game after bought a dev product.

1 answer

Log in to vote
0
Answered by 10 years ago

Try this in a GUI Button:

local Market = Game:GetService("MarketplaceService")
local Player = script.Parent.Parent.Parent.Parent
local Assets = {19874388}

script.Parent.MouseButton1Down:connect(function()
    Market:PromptProductPurchase(Player, Assets[1])
end)

Market.PromptProductPurchaseFinished:connect(function(userId, assetId, Purchased)
    if userId == Player.userId then
        if Purchased == true then
            Player.leaderstats["Money"].Value = Player.leaderstats["Money"].Value + 2
            wait(5)
        else

        end
    end
end)
Ad

Answer this question