Make your games more unique - Premium Prompt

Hey Devs! Today I will be showing you a premium purchase prompt that will allow players to purchase Premium membership through your game. We will also make a frame that will show the perks that the player will be given by being a Premium user. Unfortunately, you get nothing when someone buys Premium through your game, but there’s more chance that you will have more Premium players (More premium players, more money through Premium Payouts). It is not very unique, but there’s no reason to not adding this feature to your game!

What is the Premium Purchase Prompt?

Premium Purchase Prompt is a premium purchase prompt. After you do your action, a prompt appears with the option to buy a Premium membership.

The prompt is not customizable.

How to add it?

You can enable it by making a script. For this example, a prompt will appear when a player touches a part.

Make a script in your part.

local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local gui = script.Parent
local showPrompt = true

local function PerksGui(other)
	local player = Players:GetPlayerFromCharacter(other.Parent)
	if not player then return end
	if player.MembershipType ~= Enum.MembershipType.Premium then
		if showPrompt == false then return end
		showPrompt = false
		delay(5, function()
			showPrompt = true
		end)
		MarketplaceService:PromptPremiumPurchase(player)
		warn("Prompted Premium purchase!")
print("Part touched!")
	end
end

gui.Touched:Connect(PerksGui)
MarketplaceService.PromptPremiumPurchaseFinished:Connect(function(player)
end)

There are probably more different easier ways to do this, but I made it with instructions on the DevHub.
Now, when we touch our part a prompt appears. Everything is done in MarketplaceService so we need to check if the purchase was successful.

Purchase Premium Buttons

I made a simple button and a frame with all perks for premium members. When I click the “Premium” button a frame with perks appears. I added an invisible textbutton on the whole PremiumButton so we don’t need to copy the scripts.

Now it’s time for some scripting. Let’s start with the buttons.

I add a localscript into the invisible textbutton:

script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Visible = false
script.Parent.Parent.Parent.Premium.Visible = true
print("A player has opened the premium perks frame!")
end)

and for the exit button in our “Premium” frame.

script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Visible = false
script.Parent.Parent.Parent.PremiumButton.Visible = true
print("A player has closed the premium perks frame!")
end)

Of course, you need to reference everything differently in your game. This is a tutorial.

And we got it!

Our last part is to make the “Buy Now” button work.
We add a localscript to our buy now button.

local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local gui = script.Parent
gui.MouseButton1Down:Connect(function()
if player.MembershipType == Enum.MembershipType.Premium then
return
end
MarketplaceService:PromptPremiumPurchase(player)
end)

And we get this prompt after we click the buy now button!

Thanks!

Thanks for reading my tutorial and hopefully I showed you something that could make your next game better. Don’t expect master class scripting here, I’m learning too. My only goal in these tutorials is to show everyone easy and unique features that you could add to your game.

Check out my last tutorial! Avatar Context Menu
DevHub Link: PromptPremiumPurchase

In the end, I want to say thank you to @EmbatTheHybrid for helping me with the Buy Now button script!

13 Likes

I wonder what value adds this to your business. Why would you want your players to buy premium? I’d really hate it if Roblox gives something in return for that, it means something more to worry about and to take into account.

If you have more premium players in your game, then you earn more money.

2 Likes

Is there a Roblox’s page that describes such policies? Do you know some? Thank you very much beforehand :slight_smile:

1 Like

Here: Premium Payouts

1 Like

You can add your own benefits, not only Roblox’s.

My tutorials are supposed to add unique features. If you show more perks to a player there’s more chance that someone’s going to buy premium through your game.

Sorry but what makes you think that? If you game offers in-game bonuses for premium it would do you good to make the player aware of said bonuses. Not sure what your problem is but this is far from useless there’s no need for the hostility.

1 Like

i’m not trying to be hostile at all, and I didn’t recognize what the main purpose of this was. my bad.

1 Like