this is my local script:
local productId = 5969738
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:connect(function()
game:GetService("MarketplaceService"):PromptGamePassPurchase(player, productId)
end)
this is my local script:
local productId = 5969738
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:connect(function()
game:GetService("MarketplaceService"):PromptGamePassPurchase(player, productId)
end)
Okay so you need to have a number value for you gamepass id in your text button and your code should look a little like this
local player = game.Players.LocalPlayer
local Button = script.Parent:WaitForChild('Product1') -- Your Button
Button.MouseButton1Click:connect(function()
game:GetService("MarketplaceService"):PromptPurchase(player, Button:WaitForChild('GamePassId').Value) end)
Just make sure you change Product1 to your text button and make sure your Number Value is called GamePassId, and also this script goes inside the SURFACEGUI not the TEXTBUTTON.
What’s the difference between using a variable and a number value in this situation...?
Its easier to change a number value
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
Is your GUI in StarterGui? SurfaceGUIs can only be interacted with if they’re in a player’s PlayerGui, which gets its GUIs from StarterGui. Try putting it there and set the Adornee property from the GUI to the part it was attached to.
Thanks, I couldn't have figured that out. Can you make an answer so I can accept it?