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!

Here is my script:

marketPlaceService = game:GetService("MarketplaceService")

script.Parent.MainShop.Invincibility.BuyPrompt.MouseButton1Click:Connect(function()

marketPlaceService.PromptGamePassPurchaseFinished(player, 5094834, true)

if true then
print ("Bought")
else 
print("Not")
end
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??

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:

marketPlaceService = game:GetService("MarketplaceService")

script.Parent.MainShop.Invincibility.BuyPrompt.MouseButton1Click:Connect(function()     
    marketPlaceService:PromptGamePassPurchase(player,5094834) -- Prompting the Gamepass Purchase
end)

marketPlaceService.PromptGamePassPurchaseFinished:Connect(function(Player,Id,Result) -- Getting the result of the purchase
    if Result == true then
        print("Bought!")
    else
        print("Not bought")
    end
end)
0
The perfect answer I was looking for! Thanks man! Oficcer_F 207 — 6y
0
No problem! MRbraveDragon 374 — 6y
Ad

Answer this question