Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Weird developer product? [UNANSWERED]

Hi guys! I have a developer product. When you click on the textbutton it displays the roblox buy it now button, but for some reason it always fails. Any ideas?

--LocalScript in textbutton (in screengui)

local buyButton = script.Parent
local productId = 22343504

buyButton.MouseButton1Click:connect(function()
	Game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, productId)
end)

--Script in Workspace (Or can it be somewhere else?)

local MarketplaceService = Game:GetService("MarketplaceService")
local productId = 22343504
 

MarketplaceService.ProcessReceipt = function(receiptInfo) 
 

	for i, player in ipairs(game.Players:GetChildren()) do
		if player.userId == receiptInfo.PlayerId then
 
 
		
			if receiptInfo.ProductId == productId then
 
			
				player.leaderstats.Money.Value = player.leaderstats.Money.Value + 5
			end
		end
	end	
 
return Enum.ProductPurchaseDecision.PurchaseGranted		
end

8 comments

0

What's the error (if any)?

0

I am having no errors - it just says "Purchase failed" :(

0

Do you actually have a Dev product made? Correct hierarchy?

0

I have a dev product made.

0

And it is correct hierarchy - no errors and pretty sure :(

0

Anyone? ;(

0

I'm a newbie to developer products too. They never work for me. I wish I could help...

0

Try putting it in some "print" commands in there. So for every 5 lines, put a print command and make it say something unique. If one of them doesn't pop up, then that's where it errors. If you can narrow it down to the line that's not working, it could probably help a lot more.

1 answer

Maybe there is something wrong with your leaderboard script

This discussion is preserved as it was. New answers, comments, and votes are closed.