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

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.

How do I use it??

1 answer

✓ Accepted answer

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)

2 comments

0

The perfect answer I was looking for! Thanks man!

0

No problem!

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