Gamepass/Product pop up

How can I make a gamepass/product pop up gui so everyone can see that the player has brought the item?

For example: builderman has brought the unlimited life gamepass

2 Likes

Listen to that event, and if a purchase is made, insert a UI into each player’s PlayerGui containing the information you want to display.

4 Likes

Like what @DevSpec said, you have to use MarketPlace Prompt. However, if you need a video tutorial, check out this one:
https://www.youtube.com/watch?v=jOFrwMkl8LI

It is slightly confusing and I still don’t get some parts but I would definitely recommend it.

1 Like

“Into each player’s PlayerGui” Do you mean StarterPlayer? If so which one? StarterPlayerScripts or StarterCharacterScripts?

1 Like

Starterplayerscripts because it will be stored in the players’ playerGUI.

Also, I think you need to use a remote event to make everyone see the UI; :FireAllClients()

I tried my best, read and used the script of the article and even watched the alvinblox video, but it I’m confussed…

If anyone could be so nice and send me the script and also explain the function of the script then it would be nice.

Logic:
Basically what you do is, prompt the gamepass purchase using the MarketPlaceService, check if the player actually bought it. If yes, fire a RemoteEvent to all players. On the client’s side, make a localscript to listen to the RemoteEvent, and change the required UI element’s text.

Pseudo script:
Server script:

local MarketplaceService = game:GetService("MarketplaceService")
     
MarketplaceService.PromptPurchaseFinished:Connect(function(player, assetId, isPurchased)
    if not isPurchased then return end
    remoteEvent:FireAllClients(player.Name)
end)

Local script:

remoteEvent.OnClientEvent:Connect(function(playerName)
    UiElement.Text = playerName.." has bought the gamepass!"
end)

Edit: Accidentally sent while writing :sweat_smile:

Psuedo script? By the way where do I put the local and regular script at? Like in the StarterPlayerScripts?

The server script goes in the ServerScriptService, and the LocalScript goes where ever you want, preferably the UI element whose text you want to change when someone buys the gamepass.

Do I have to change UiElement? Because it’s underlined and it doesn’t work.

Sorry, I accidentally replied.

You said the localScript goes where ever I want, but still the script is not working. Most of the words such as remoteEvent and UiElement is orange underlined. Could you help me a bit further on that one?