Devproduct Doubling after buying twice

So i have a devproduct script that buys a devproduct
It doubles the points value when you buy it twice or more, like if you buy it three times then the third time you buy it you get 300 points instead of 100
I looked at scripts and they said to add Enum.ProductPurchaseDecision.Granted
but it doesnt work for me

my code

local marketplaceservice = game:GetService("MarketplaceService")
local id100 = 1762467891
local id250 = 1762468506
local id500 = 1762468954
local id1000 = 1762470712
	
marketplaceservice.ProcessReceipt = function(receiptInfo)	
	local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
	
	local id = receiptInfo.ProductId
		marketplaceservice.PromptProductPurchaseFinished:Connect(function(playe, id, ispurchased)

			if id == id100 and ispurchased == true then
				player.leaderstats.Points.Value += 100
				print(player.Name .. " bought the 100 devproduct")
				return Enum.ProductPurchaseDecision.PurchaseGranted
		elseif id == id250 and ispurchased == true then
				player.leaderstats.Points.Value += 250
				print(player.Name .. " bought the 250 devproduct")
			return Enum.ProductPurchaseDecision.PurchaseGranted
		elseif id == id500 and ispurchased == true then
				player.leaderstats.Points.Value += 500
				print(player.Name .. " bought the 500 devproduct")
			return Enum.ProductPurchaseDecision.PurchaseGranted
		elseif id == id1000 and ispurchased == true then
				player.leaderstats.Points.Value += 1000
				print(player.Name .. " bought the 1000 devproduct")
			return Enum.ProductPurchaseDecision.PurchaseGranted
			end
		end)
end

Don’t use this inside of process receipt

Fires when a purchase prompt closes for a developer product, right as the dialog closes when the player presses “Cancel” at the prompt or “OK” at the success/error message. You can use this event to detect when a purchase prompt is closed, but it should not be used to process purchases; instead use MarketplaceService.ProcessReceipt.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.