How can I make something where when you buy something (a gamepass), a GUI Pops up

Hello! How can I make something where when you purchase something (a gamepass), it brings up a Gui saying “Thanks for purchasing”. How can I achieve this?

Thanks! Any help will be appreciated!

1 Like

I reccommend searching YouTube videos first if you haven’t alraedy. But, basically what I’d do is when the game pass is bought I would make a gui and make it visible to show the “Thank you for purchasing” and maybe make it disappear after a couple seconds or just add a close button.

Well what do I do to know when it’s purchased? That’s the whole reason why I am asking

Quick question would this be a gui for the gamepass or a touch pad that opens the buy prompt?

So basically I already have the thing done for when you click it the purchase prompt already shows up, but I am asking how can I make it when you PURCHASE the gamepass from that prompt, it pops up a GUI saying “Thanks for purchasing”

Sorry if I didn’t make it clear

Don’t worry it’s okay. It’s my part for not understanding.
Here’s what you’re looking for I think:

3:53 is where you need it.

No, that’s not what I mean at all. I am trying to say when they purchase that one thing, it shows up ONCE after they purchase it, it will never show up again till they purchase a new developer product, for instance a gamepass.

Sorry I don’t think I can help you. From what I understand this is what I would put:

local id = --id
mps.PromptProductPurchaseFinished:Connect(function(player,ido,purchased)
   if purchased and ido == id then
       --make gui visible
   end
end)

Well, good luck then

What is mps supposed to be? You left that out

Sorry I meant market place not the id I accidently thought it was something else so it would be something like:
game:GetService(“MarktetPlaceService”)

Do you mean your gamepass ID??

Sorry I meant mps stands for market place service.

Here you go:

local player = game.Players.LocalPlayer
local ownsGamepass = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,0)--Change the 0 to the gamepass ID
local frame = player.PlayerGui.PopUpGui.PopUpFrame --Change this to the frame you want to pop up

if ownsGamepass then
		frame.Visible = true
end	


--[[
Make sure that:
1.The script is in StarterGui
2.That you make a GUI => FRAME => TEXTLABEL
3.Make the textlabel visible and the GUI visible, but the frame invisible

Here's how the script works:

ok so here's how the script works:
At line 1 we get the local player
At line 2 we get the player owning the gamepass
At line 3 we get the frame that will popup
At line 4 we check if the player owns the gamepass
At line 5 we make the Popup frame visible if the player owns the gamepass
At line 6 we end the script
--]]

Test the script in game not in studio, because it might not work in studio.

1 Like