AcquireProductFinished

格式

AcquireProductFinished(Player,ProductId,wasPurchased)

简介

当购买游戏商品的弹窗关闭或玩家取消购买或购买失败时,本事件触发,并将购买记录存到ProductPurchasedRecord,如未购买或取消或购买失败,则不会记录

实例

local MarketService = GetService("MarketExchangeService") --获取内购服务

wait(0.5) 
local player = Players:GetLocalPlayer() -- 获取本地的玩家对象
local ProductId = 218 -- 获取商品Id

MarketExchangeService.AcquireProductFinished:Connect(function(player,ProductId,wasPurchased)
        print(string.format("玩家[ %s ],wasPruchased:--[ %s ],购买了id为[ %s ]的商品",
                player.Name,tostring(wasPurchased),ProductId))
    end)

wait(3)
MarketService:AcquireProduct(player, ProductId) -- 提示玩家去购买id为ProductId的商品
文档更新时间: 2020-07-11 17:25   作者:孙晓艺