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

Will this script work?

Asked by 10 years ago
local MORE_COINS_ID = (Game.PlaceId == 106280854) and 19945361 or 19945373
local MarketplaceService = Game:GetService('MarketplaceService')
local Player = PlayerGui.Parent

local function OnPromptProductPurchaseFinished(userId, productId, isPurchased)
    _G.print("OnPromptProductPurchaseFinished:", userId, productId, isPurchased)
    if isPurchased and userId == Player.userId and productId == MORE_COINS_ID then
        _G.print("Success")
        _G.GivePlayerCoins(Player, 150)
        _G.GivePlayerPoints(Player, 1)
    else
        _G.print("Failure")
    end
end

MoreCoinsButton.MouseButton1Click:connect(OnMoreCoinsClicked)
MarketplaceService.PromptProductPurchaseFinished:connect(OnPromptProductPurchaseFinished)

The last line is... :connnect(OnPromptProductPurchaseFinished)

The script suppose to Give playerpoints and coins when someone purchase a product.

will this work? if not please explain why not and if you can fix it.

Thanks for all the helpers!

0
Just in advance, check in studio to see if it works? Tempestatem 884 — 10y

Answer this question