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