How do I use PromptGamePassPurchaseFinished
PLEASE DO DO NOT SEND A LINK, THE ROBLOX LINK IS LACKING!
01 | Here is my script: |
02 |
03 | marketPlaceService = game:GetService( "MarketplaceService" ) |
04 |
05 | script.Parent.MainShop.Invincibility.BuyPrompt.MouseButton 1 Click:Connect( function () |
06 |
07 | marketPlaceService.PromptGamePassPurchaseFinished(player, 5094834 , true ) |
08 |
09 | if true then |
10 | print ( "Bought" ) |
11 | else |
12 | print ( "Not" ) |
13 | end |
14 | end ) |
Why do I get this error: attempt to call field 'PromptGamePassPurchaseFinished' (a userdata value)
Thank you so much in advance.
How do I use it??
PromptGamePassPurchaseFinished()
Is an Event, not a function. If you want to prompt a Gamepass you would use PromptGamePassPurchase()
, which is a Function.
You can read about it here:
https://www.robloxdev.com/api-reference/function/MarketplaceService/PromptGamePassPurchase
Here's a Code example:
01 | marketPlaceService = game:GetService( "MarketplaceService" ) |
02 |
03 | script.Parent.MainShop.Invincibility.BuyPrompt.MouseButton 1 Click:Connect( function () |
04 | marketPlaceService:PromptGamePassPurchase(player, 5094834 ) -- Prompting the Gamepass Purchase |
05 | end ) |
06 |
07 | marketPlaceService.PromptGamePassPurchaseFinished:Connect( function (Player,Id,Result) -- Getting the result of the purchase |
08 | if Result = = true then |
09 | print ( "Bought!" ) |
10 | else |
11 | print ( "Not bought" ) |
12 | end |
13 | end ) |