Annexsohn
(Annexsohn)
November 8, 2021, 8:09pm
#1
Hello! How can I make it when you purchase a Developer Product, such as a gamepass or a Developer Product, after you purchase the Developer Product (Gamepass, etc) It will pop up a GUI saying thanks for purchasing. How can I achieve this? I already have the thing for where it shows the Purchase Prompt, but I want something that after you buy from the Purchase Prompt that roblox gives you, and it will know when you purchase it will pop up a GUI saying thanks for puchasing
Example Video of what I mean:
(Purchase prompt shows up, after you press buy, it will know you bought it, then it will open the GUI, how can I achieve this?
Thanks! Any help will be appreciated!
7 Likes
Can I please see your PromptProductPurchase Script?
2 Likes
Annexsohn
(Annexsohn)
November 8, 2021, 8:11pm
#3
local GamepassId = 00000000
script.Parent.MouseButton1Click:Connect(function()
game:GetService(“MarketplaceService”):PromptGamePassPurchase(game.Players.LocalPlayer, GamepassId)
end)
(This is for the Gamepass)
2 Likes
Did you already make a thanks message GUI?
If so, whats the path?
1 Like
I think you could just use PromptGamePassPurchaseFinished, which fires when a prompt closes, either by purchasing or cancelling (which you can find with the parameter wasPurchased
)
https://developer.roblox.com/en-us/api-reference/event/MarketplaceService/PromptGamePassPurchaseFinished
1 Like
Annexsohn
(Annexsohn)
November 8, 2021, 8:14pm
#6
Yes, I did, just put ThanksForBuying as an example name, and its in ScreenGUI
1 Like
local GamepassId = 00000000
script.Parent.MouseButton1Click:Connect(function()
game:GetService(“MarketplaceService”):PromptGamePassPurchase(game.Players.LocalPlayer, GamepassId)
If success then
game.StarterGUI.ThankYouMessage.Visible = true
wait(3)
game.StarterGUI.ThankYouMessage.Visible = true
end
end)
2 Likes
local GamepassId = 00000000
script.Parent.MouseButton1Click:Connect(function()
game:GetService(“MarketplaceService”):PromptGamePassPurchase(game.Players.LocalPlayer, GamepassId)
game.StarterGUI.ThankYouMessage.Visible = true
wait(3)
game.StarterGUI.ThankYouMessage.Visible = false
end
end)
2 Likes
Check out the post above this one. I edited it.
1 Like
Annexsohn
(Annexsohn)
November 8, 2021, 8:25pm
#11
I am now getting this error
1 Like
local GamepassId = 00000000
script.Parent.MouseButton1Click:Connect(function()
game:GetService(“MarketplaceService”):PromptGamePassPurchase(game.Players.LocalPlayer, GamepassId)
game.StarterGUI.ThankYouMessage.Visible = true
wait(3)
game.StarterGUI.ThankYouMessage.Visible = false
end)
end)
1 Like
Annexsohn
(Annexsohn)
November 8, 2021, 8:27pm
#13
By the way, I will have a Close button the GUI, so no need for the 3 second wait to close.
2 Likes
Alright. Then just make then get rid of the wait and the visible = false
1 Like
Annexsohn
(Annexsohn)
November 8, 2021, 8:29pm
#15
Alright, so would this be the script?
local GamepassId = 23359376
script.Parent.MouseButton1Click:Connect(function()
game:GetService("MarketplaceService"):PromptGamePassPurchase(game.Players.LocalPlayer, GamepassId)
local StarerGUI = script.Parent.Parent.Parent.Parent.Parent.Parent
game.StarterGUI.ThankYouMessage.Visible = true
end)
Also would I need to test this in-game?
2 Likes
local GamepassId = 23359376
script.Parent.MouseButton1Click:Connect(function()
game:GetService("MarketplaceService"):PromptGamePassPurchase(game.Players.LocalPlayer, GamepassId)
local StarerGUI = script.Parent.Parent.Parent.Parent.Parent.Parent
game.StarterGUI.ThankYouMessage.Visible = true
end)
Perfect. Try it and tell me if it works.
2 Likes
Thats not me. You must have done the GUI path wrong
Edit: Change “StarterGUI” to
local StarterGUI = game.StarterGUI
StarterGUI.ThankYouMessage.Visible = true
1 Like
Annexsohn
(Annexsohn)
November 8, 2021, 8:34pm
#19
I don’t think I did the path wrong? It shows that everything is right
1 Like
local GamepassId = 23359376
script.Parent.MouseButton1Click:Connect(function()
game:GetService("MarketplaceService"):PromptGamePassPurchase(game.Players.LocalPlayer, GamepassId)
local StarterGUI = script.Parent.Parent.Parent.Parent.Parent.Parent
StarterGUI.ThankYouMessage.Visible = true
end)
The end result unless the path for making is visible is wrong.
1 Like