PromptPremiumPurchaseFinished

I have this code:

local mps = game:GetService("MarketplaceService")
mps.PromptPremiumPurchaseFinished:Connect(function(player, isPurchased)
if isPurchased == true then
script.Parent.hasPremium.Value = true
print("successful")
end
end)
Hierarchy

The code above is in a LocalScript and parented to StarterGui
The Value ‘hasPremium’ is a bool value parent to StarterGui

Since I am already a premium member I cannot test this. All I need to know is if mps.PromptPremiumPurchaseFinished:Connect(function(player, isPurchased)
will work.

U can stil test it. The prompt Will just tel you that u already have premium

PromptPremiumPurchuseFinished itself does not return if the premium purchuse was successful. I would look into adding PlayerMembershipChanged to see if the player bought Premium.

FYI This is part of Players and is not part of MPS

2 Likes

Can that function run in a LocalScript?

I wouldn’t suggest running these in LocalScripts since exploiters could just bypass it if it was in a LocalScript.

1 Like