Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why won't this script work?

Asked by
Wkay 0
9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.
local productId = 322937935
script.Parent.MouseButton1Click:connect(function()
local player =  script.Parent.Parent.Parent.Parent.Parent
game:GetService("MarketplaceService"):PromptProductPurchase(player, productId)
end)

This script is meant to have a player buy a gamepass when a GUI TextButton is pressed, but when I press it, it won't work. Can somebody please fix this?

0
What kind of script is this and what is it under in the Explorer? Spooce 78 — 9y
0
It's a normal script and it's supposed to be for a GUI button where when you press it, you can buy something. Wkay 0 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

Possibly because your trying to pop up a prompt to a model? That's my guess. Try this


local productId= 322937935 local player = script.Parent.Parent function BuyMe() game:GetService("MarketplaceService"):PromptProductPurchase(player, productId) end game.StarterGui.(LocationOfYourButtonHere).MouseButton1Click:connect(BuyMe)
Ad

Answer this question