Robux Prompt Background Effect

Hello! I was wondering if there’s any posts related to this and I was wondering how I could make one for myself. Basically, I want to make it so that when a purchase prompt is activated, sort of a background effect appears. You can take a look at pet simulator 99, it sort of does exactly what I need:

3 Likes

You can use MarketPlaceService:PromptGamePassPurchase() and MarketPlaceService.PromptGamePassPurchaseFinished to check if the player has bought the gamepass. Heres an example:

local MPS = game:GetService("MarketplaceService")

local Player = game.Players.LocalPlayer

local ID = 111111--Your ID

local Button = script.Parent--Your Button

--Put into a button event
Button.MouseButton1Click:Connect(function()
	MPS:PromptGamePassPurchase(Player, ID)
	--Open UI
end)

MPS.PromptGamePassPurchaseFinished:Connect(function(plr, gamepassID, wasPurchased)
	if plr and gamepassID == ID and wasPurchased then
		--If bought
	end
	
	if not wasPurchased then
		--Close UI
		print("Player did not purchase")
		return
	end
end)
2 Likes

Appologies for the late response, what would I do if I wanted the animation to happen with every prompt purchases, not a specific ID?

1 Like

maybe you could try adding a module script containing all the ID’s?

1 Like

I guess so :+1: thanks 033030303030

1 Like

You can just remove these lines

if plr and gamepassID == ID and wasPurchased then
    --If bought
end

I believe the reason they were added is to show a different message for each gamepass.

So something like this (edited version of @JAcoboiskaka1121’s answer)

MPS.PromptGamePassPurchaseFinished:Connect(function(plr, gamepassID, wasPurchased)
	if wasPurchased then
        print("Player purchased")
	else
		print("Player did not purchase")
	end
end)
2 Likes

I added them so you can add logic to each gamepass, if you buy 1000 coins you can add some lines that do that. But I guess that’s not what he wanted.

1 Like

Make a module of all your IDs and use a for loop to loop through them and connect a MarketPlaceService.PromptGamePassPurchasedFinished event. Same thing for your buttons.

1 Like