What does this do differently then the one I have already?
Doesnât wait 3.25 seconds after each purchase (it just checks if the player is valid) if they are then the purchase is granted, if theyâre not then the purchase is regarded as unprocessed and the next time they join, the game will attempt to award whatever was purchased.
The wait I added because I want it to wait 3.25 seconds before it purchases so it can match when the GUI opens when you purchase. And what do you mean by if the player is valid.
If the player who bought the product still has their player object in the game. For example, say a user bought a product but accidentally left or disconnected before the purchase was awarded, now the game will note that purchase as unprocessed and will attempt to process it the next time they join.
So if theyâre just still inside the game?
MPService.PromptProductPurchaseFinished:Connect(function(UserId, ProductId, IsPurchased)
if IsPurchased then
StarterGui.ThankYouMessage.Visible = true
end
end)
What is the product id for this?
and is âStarterGuiâ the StarterGui folder or is it a âScreenGuiâ?
Oh, I already have that done, donât worry about that! And also thanks, I appreciate your help!
I was going to add it to the ProcessReceipt.
This is the script for one of them (The Developer Product)
local MPService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local Player = Players.LocalPlayer or Players.PlayerAdded:Wait()
local StarterGui = script.Parent.Parent.Parent.Parent.Parent.Parent
local ProductId = 1212048436 --change to developer product id
script.Parent.MouseButton1Click:Connect(function()
game:GetService("MarketplaceService"):PromptProductPurchase(Player, ProductId)
StarterGui.LoadingPurchase.Enabled = true
end)
MPService.PromptProductPurchaseFinished:Connect(function(UserId, ProductId, IsPurchased)
if IsPurchased then
StarterGui.RobuxShopMenu.Enabled = false
StarterGui.ThankYouMessage.Frame.Visible = true
wait(0.4)
StarterGui.LoadingPurchase.Enabled = false
elseif not IsPurchased then
-- print("The user canceled the prompt")
StarterGui.LoadingPurchase.Enabled = false
end
end)
Are you trying to add the ProcessRecipt?