I did try to find my answer of ROBLOX Wiki. Nothing showed.
There is actually a specific service for things like this called MarketplaceService.
http://wiki.roblox.com/index.php?title=MarketplaceService
The specific method you want here is PromptPurchase(Player, AssetId)
.
Example code:
1 | local function RequestPurchase(Player, AssetId) |
2 | game:GetService( "MarketplaceService" ):PromptPurchase(Player, AssetId) |
3 | end |