:PromptProductPurchase Issue

Context

I have a server script which gets a user’s launch data and uses that to send a remote event to the client that joined. From there the game prompts the user to purchase a developer product.

The issue

No prompt appears.

Code

Here’s the code in my local script:

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local MarketplaceService = game:GetService("MarketplaceService")
local PromptPurchase = ReplicatedStorage:WaitForChild("PromptPurchase")

PromptPurchase.OnClientEvent:Connect(function(ProductID)
    print(1) -- prints fine

	MarketplaceService:PromptProductPurchase(Players.LocalPlayer, ProductID)

    print(2) -- prints fine
end)

Things to note

  • Both the server and client scripts are triggering
  • The developer product is for sale and was created for this game
  • I’ve wrapped the :PromptProductPurchase function in a pcall and it returns success
  • This code used to work but for some reason stopped working
  • There are no errors in the console
  • I’ve looked thoroughly through other posts and my issue still stands
  • I’ve tested the code both in-game and in studio
  • Both the product ID and the local player print fine
  • Allow HTTP Requests, Enable Studio Access to API Services and Allow Third Party Sales are all enabled in my game
  • I’ve tried moving the local script to the StarterGui and StarterCharacterScripts from StarterPlayerScripts and I’ve observed nothing different than the usual bug
  • I’ve tested the same code in a different game with a different developer product ID (created in the new game) and I’m still getting the same results
  • Calling :GetProductInfo returns info about the developer product as expected

Is there something I’m doing wrong since it doesn’t work in any of my games? Is it a Roblox bug since it’s only been happening recently? Please let me know your thoughts and/or similar experiences.

Have you tried printing the ProductID? The only possible issue I see would be that the productID is nil or invalid.

1 Like

Yeah, the developer product ID prints as 1347812656 and the local player prints fine too.

I’ve tried to do the same thing you did on studio and I’ve noticed the same thing was happening to me, the localscript was printing fine but there was nothing happening at all, as a guess I put a timer so the player interface would actually load completly and it started working completly fine, can you try that and give an update?

1 Like

Thanks a lot, simply adding wait(2) before calling the remote event in the server script fixed the issue! I suppose, as you mentioned, the interface wasn’t fully loaded and therefore wasn’t able to load the prompt in time.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.