Developer products work in studio, not in game


Script: (A little out of context)

local  Mks = game:GetService("MarketplaceService")

Mks.ProcessReceipt = function(Ids)
	local Player = game.Players:GetPlayerByUserId(Ids.PlayerId)
	require(DevProducts[Ids.ProductId])(Player) -- A module script with the function that actually gives the gamepass, not important.
		
	return Enum.ProductPurchaseDecision.PurchaseGranted
end

I prompted the purchase from a local script with PromptProductPurchase.

This happens with and without me returning the purchase granted enum.

I found a page on the Developer Hub that’ll help:

It discusses everything about Developer Products, as well as specific functions and how to handle the purchases. There’s some sample code you can look at as a reference.

I think you should use a pcall. If you don’t know what a pcall function is,

local success, error = pcall(function()
--- type developer product information here
end

if success then 
print("Sucessfully Working!")
else
print(error)


With this way, you can successfully track the error you are facing in game by prompting the purchase, then when it shows the error. Then, go to in-game developer logs and check what error message it has.

Also, track the error it made and learn from it by searching up, “Error Messages” on roblox. Forgot the link to it though so :neutral_face:

Could you show the code where you prompt the purchase? The code you provided is the receipt.

It’s just one line of code, I figured saying I used PromptProductPurchase would cover it.

Mks:PromptProductPurchase(game.Players.LocalPlayer, my dev product id which I don't have atm)and

That article doesn’t have anything on this error

There are no errors in the output, since it doesn’t technically error that would just print “Successfully working”