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

attempt to call field 'PromptGamePassPurchaseFinished' (a userdata value)? [URGENT! PLEASE HELP!]

Asked by
Oficcer_F 207 Moderation Voter
6 years ago

How do I use PromptGamePassPurchaseFinished

PLEASE DO DO NOT SEND A LINK, THE ROBLOX LINK IS LACKING!

01Here is my script:
02 
03marketPlaceService = game:GetService("MarketplaceService")
04 
05script.Parent.MainShop.Invincibility.BuyPrompt.MouseButton1Click:Connect(function()
06 
07marketPlaceService.PromptGamePassPurchaseFinished(player, 5094834, true)
08 
09if true then
10print ("Bought")
11else
12print("Not")
13end
14end)

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??

1 answer

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago

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:

01marketPlaceService = game:GetService("MarketplaceService")
02 
03script.Parent.MainShop.Invincibility.BuyPrompt.MouseButton1Click:Connect(function()    
04    marketPlaceService:PromptGamePassPurchase(player,5094834) -- Prompting the Gamepass Purchase
05end)
06 
07marketPlaceService.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
13end)
0
The perfect answer I was looking for! Thanks man! Oficcer_F 207 — 6y
0
No problem! MRbraveDragon 374 — 6y
Ad

Answer this question