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
5 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.

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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)
0
'local onFinish', next line, 'onFinish = function' hurts my brain. bhqpping 80 — 5y
0
So what? AswormeDorijan111 531 — 5y
Ad

Answer this question