There is an output error when i'm trying make it but it wont work. The script is:
script.Parent.MouseButton1Click:Connect(function() game:GetService("MarketplaceService"):PromptPurchase(4862753) end)
So if you want to use the gamepassGui there is the localscript:
function Click() local players = game.Players.LocalPlayer local id = 4862753 game:GetService("MarketplaceService"):PromptGamePassPurchase(players, id) end script.Parent.MouseButton1Click:Connect(Click)
First of all, you should be using PromptGamePassPurchase because it's a gamepass. Here!
As you can see, the first argument is UserID. To get that userId, use LocalPlayer. The second argument is the gamepass id
Here's your script fixed:
local player = game.Players.LocalPlayer script.Parent.MouseButton1Click:Connect(function() game:GetService("MarketplaceService"):PromptGamePassPurchase(player.UserId,ID) end) --Put the gamepass id where it says "ID"
Be sure to use the correct one!