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

What is wrong with this DeveloperProduct script?

This LocalScript is locating in a textbutton, and on click it should promptpurchase, and if purchased change the visible property of two frames. When I click it, it doesn't do anything. Yes, my hierarchies are correct and no, I cannot show the output, because you can't purchase developer products in studio apparently.

local productId = 22903689
player = game.Players.LocalPlayer
gui = player.PlayerGui.ScreenGui
loading = gui.loading
results = gui.results
MarketplaceService = game.GetService("MarketplaceService")

script.Parent.MouseButton1Down:connect(function(player)
	game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, productId)
	MarketplaceService.ProcessReceipt = function(receiptInfo) 
		
 
	
	for i, player in ipairs(game.Players:GetChildren()) do
		if player.userId == receiptInfo.PlayerId then
 
 
			
			if receiptInfo.ProductId == productId then 
				loading.Visible = false
				results.Visible = true
			end
		end 
	end
	end
	
			
	end)

1 comment

0

Yes this is a re-post, the first time all I got were troll answers :/

1 answer

✓ Accepted answer

Your problem is that, unfortunately, you cannot set the ProcessReceipt for MarketplaceService with a localscript.

So, to fix? You need to have the ProcessReceipt in a serverscript, preferably in ServerScriptStorage.

2 comments

0

Okay thanks, how would I do that? I am a novice scripter lol

0

line 10 - 25 should be in a separate script in SeverScriptStorage.

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