This LocalScript inside a text button is supposed to prompt the player to buy the gamepass with the ID: 5412979. When I click it, it either says the item is not currently for sale or prompts me to buy a different item. Here is the script:
local productId = 5412979 -- change to your Gamepass product ID
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:connect(function() --DONT CHANGE THIS
game:GetService("MarketplaceService"):PromptPurchase(player, productId)
end)
Any help is appreciated!

5 comments
Would not recommend watching a video for programming help, anything could be wrong and you won't know until you copy down all the code from the video by hand, which would just be really disappointing. Better to use a forum like this or the official devForum.
yeah but at least you can see what the script maker is writing so there won’t be any viruses.
https://www.youtube.com/watch?v=dQnTzdIPRHY
Thank you for all your help!
np