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

PlayerPoints / Marketplace Issue?

I'm trying to make a marketplace service shop where you can buy player points. I can't seem to get the script to register that the player has bought the developer product. Can anyone help? This is the script to buy the product:

local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:connect(function()
	game:GetService("MarketplaceService"):PromptProductPurchase(player, 19642075)
end)

and this is the script that is supposed to register the purchase:

local MarketplaceService = Game:GetService("MarketplaceService")
local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
local points = game:GetService("PointsService")

local twoPoints = 19642075

MarketplaceService.ProcessReceipt = function(receiptInfo) 
	for i, player in ipairs(game.Players:GetChildren()) do
		if player.userId == receiptInfo.PlayerId then
			if receiptInfo.ProductId == twoPoints then
				points:AwardPoints(player.userId, 2)
			end
		end
	end		
	local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_purchase_" .. receiptInfo.PurchaseId
	ds:IncrementAsync(playerProductKey, 1)	
	
	return Enum.ProductPurchaseDecision.PurchaseGranted		
end
	

1 answer

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