Developer Product not working

Local Script:

local plr = game.Players.LocalPlayer
local mps = game:GetService("MarketplaceService")
local id = 1301857815

script.Parent.MouseButton1Click:Connect(function()
	mps:PromptProductPurchase(plr.UserId, id)
	
	mps.PromptGamePassPurchaseFinished:Connect(function(plr, id, purchased)
		if purchased then
			print("purchased")
		end
	end)
end)
local plr = game.Players.LocalPlayer
local mps = game:GetService("MarketplaceService")
local id = 1301857815

script.Parent.MouseButton1Click:Connect(function()
	mps:PromptProductPurchase(plr.UserId, id)
end)

mps.PromptGamePassPurchaseFinished:Connect(function(plr, productid, purchased)
	if purchased and productid == id then
		print("purchased")
	end
end)

don’t do it in the mouse click function

Unfortunately it doesn’t work, but this is the error I get:

Unable to cast value to Object  -  Client - LocalScript:6

I think u should use the plr only instead of the id of the plr

mps:PromptProductPurchase(plr, id)

Ok, that’s the first issue fixed. It now prompts the product purchase, but it still doesn’t print “purchased” when the product is bought.

try putting the promptgamepasspurchasefinished function in a server script

It still doesn’t work for some reason.

Use this function: MarketplaceService.PromptProductPurchaseFinished
it’s a bit old but it still works

You are using a PromptGamePassPurchaseFinished for a dev product wich is wrong. (Since PromptGamePassPurchase works only for gamepass) Not for dev product

1 Like