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.
You've made some errors in your code. It should be handled on the server.
local MarketplaceService = game:GetService("MarketplaceService") local ID = 0000000009 -- put your id here local onFinish onFinish = function(player, passId, isPurchased) if passId == ID then -- check if id if isPurchased then -- if they purchased it, not click cancel -- code else print("Not bought") end end end MarketplaceService.PromptGamePassPurchaseFinished:Connect(onFinish)