Help with PromptGamePassPurchase in SurfaceGui

Hello, I’ve been trying to make a button on a SurfaceGui to send a gamepass prompt when someone clicks on it although when I click on it, nothing shows up… I don’t know if it’s not possible to do such in SurfaceGuis therefore I’m looking for help!

Where it says “PURCHASE- 199R$”, I want to make it send a gamepass purchase prompt when someone clicks on it.

I’m using a LocalScript which I’m unsure if it’s the correct type of script.
This is the code I have so far:

script.Parent.MouseButton1Click:Connect(function()
	game:GetService("MarketplaceService"):PromptGamePassPurchase(game.Players.LocalPlayer,41737622)
end)

I’d suggest looking through the events on the following website and go from there.

[SurfaceGui]

Where is the GUI located in the Explorer menu?

It’s in Workspace in a part named screen-tv

LocalScripts do not run in Workspace. Move the SurfaceGui to StarterGui then set its Adorenee to the part.

1 Like

Was about to say this, but just realised you already posted it. :+1:

1 Like

Thank you so much! I’ve been stuck with this for some time.