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

GUI Gamepass Buy Button: Showing T-Shirt, not gamepass?

Asked by 5 years ago

I have made a gamepass shop in which if a person clicks a button, they buy a gamepass. For some reason, it shows a T-Shirt instead of the gamepass when I click the buy button to test it. I am not sure why it does this.

CODE PUT INSIDE THE BUTTON:

local productId = 4897669
local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:connect(function() 
    Game:GetService("MarketplaceService"):PromptPurchase(player, productId)
end)

Please help!

1 answer

Log in to vote
0
Answered by 5 years ago

This is because you are using the wrong method. PromptPurchase is for things like clothing. Use PromptGamePassPurchase instead.

local productId = 4897669
local player = game:GetService("Players").LocalPlayer

script.Parent.MouseButton1Click:Connect(function() -- :connect is deprecated, use :Connect
    Game:GetService("MarketplaceService"):PromptGamePassPurchase(player, productId)
end)


Ad

Answer this question