Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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. 



1 answer

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)

2 comments

0

'local onFinish', next line, 'onFinish = function' hurts my brain.

0

So what?

This discussion is preserved as it was. New answers, comments, and votes are closed.