Pay for the order||doc136056

September 20, 2022


Game.GetService("PayHelper"):payMoney(player, uniqueId, price, callBack)
  • The class to which the function belongs:PayHelper


A pop-up window prompting payment for the specified player.

When a designated user asks him to pay for the Golden Cube to purchase in-game services, a pop-up window will first prompt the user whether to confirm the purchase, and the payment request will be ignored before the user confirms.

The result of the purchase is used as a parameter to execute the callback function. If it fails, the golden cube is insufficient.


Variable name type Description
player Player player instance
uniqueId int Unique identification of the commodity, range limit [-2147483648 ~ 2147483647]
price int price
callback function Callback function with purchase result as parameter

Code Samples

When the player dies, give the player a payment request to buy resurrection, and register the death trigger in the player server code

Trigger.RegisterHandler(this:cfg(), "ENTITY_DIE", function(context)
    local player = context.obj1
    Game.GetService("PayHelper"):payMoney(player, 1, 10, function(ret)
        if ret then