So i am trying to make a purchase system that detects immediately after its purchased and not when you press the OK button, i dont really have a screenshot atm but i want to detect when you click the purchase button and it validates the purchase and not when clicking the OK button right after you purchased it.
i tried everything but couldnt do what i wanted to do
this is so that if a player gets disconnected right after making the purchase they dont get scammed, how can i do this?
how they get scammed if they leave immediately after the purchase , also no one is going to leave the game after purchasing any thing immediately they may get disconnected , you can save the purchase in datastore so if the any player purchase a developer product and then disconnected it will be saved that player purchase that item and did not use it
Not something I work with much right now, but I think pcalls prevent you accidentally giving them an item if they get disconnected immediately after purchase.
ProcessReceipt in an event it will fire when a player try to buy a developer product , it gives you a ReceiptInfo table , you need to return an Enum.ProductPurchaseDecision to the event , you do not need to wrap this in a pcall
local MarketplaceService = game:GetService("MarketplaceService")
local function onPromptPurchaseFinished(player, assetId, isPurchased)
if isPurchased then
print(player.Name, "bought an item with AssetID:", assetId)
else
print(player.Name, "didn't buy an item with AssetID:", assetId)
end
end
MarketplaceService.PromptPurchaseFinished:Connect(onPromptPurchaseFinished)