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)