Problem With Developer Product

Hey, I have a problem! When i purchase the dev product it does not give me any cash? Can you resolve this issue?

this is in serverscriptservice:

local devproID = 1650729210
local Marketplacesevice = game:GetService("MarketplaceService")

local function processReceipt(receiptInfo)
	local player = game:GetService("Players")
	local plrusID = player:GetPlayerByUserId(receiptInfo.PlayerId)
	if not plrusID then
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end
	
	if plrusID then
		print("done5")
		player.leasderstats.Cash.Value += 100000
	end
	return Enum.ProductPurchaseDecision.PurchaseGranted
end

Marketplacesevice.ProcessReceipt = processReceipt

Not sure if this is the only issue but leaderstats is misspelled.

I am sorry lol i am so stupid lmao :frowning:

But an error occured it says that leaderstats is not in players?

I don’t have much experience with developer products but typically you would reference the player making the purchase, right? In your script:

This is referencing the list of all players in the game and trying to assign cash to a player instance, not the folder inside a specific player. Check out the documentation here and see if it helps!

I will surely check it out! Thanks For The Help!

hey i checked it out and it is not working? i did as same as the document told me?

local devproIDGod = 1650733652
local devproIDsuper = 1650731748
local devproIDultra = 1650730956
local devproIDpro = 1650730083
local devproIDnoob = 1650729210
local Marketplacesevice = game:GetService("MarketplaceService")
local Players = game:GetService("Players")

local productFunctions = {}

-- Gives the user 100,000 cash
productFunctions[devproIDnoob] = function(player)
    local leaderstats = player:WaitForChild("leaderstats")
	local cash = leaderstats:WaitForChild("Cash")
	if cash then
		cash.Value += 100000
	end
end

-- Gives the user 100,000,000
productFunctions[devproIDpro] = function(receipt, player)
	-- make it that when it is run it would give player 100000000
			local leaderstats = player:WaitForChild("leaderstats")
			local cash = leaderstats:WaitForChild("Cash")
			if cash then
				cash.Value += 100000000
			end
end

-- Gives the user 1b
productFunctions[devproIDultra] = function(receipt, player)
	-- make it that when it is run it would give player 100000000
	local leaderstats = player:WaitForChild("leaderstats")
	local cash = leaderstats:WaitForChild("Cash")
	if cash then
		cash.Value += 1000000000
	end
end

-- Gives the user 100b
productFunctions[devproIDsuper] = function(receipt, player)
	-- make it that when it is run it would give player 100000000
	local leaderstats = player:WaitForChild("leaderstats")
	local cash = leaderstats:WaitForChild("Cash")
	if cash then
		cash.Value += 100000000000
	end
end

-- Gives the user 1T
productFunctions[devproIDGod] = function(receipt, player)
	-- make it that when it is run it would give player 100000000
	local leaderstats = player:WaitForChild("leaderstats")
	local cash = leaderstats:WaitForChild("Cash")
	if cash then
		cash.Value += 1000000000000
	end
end




local function processReceipt(receiptInfo)
	local userId = receiptInfo.PlayerId
	local productId = receiptInfo.ProductId

	local player = Players:GetPlayerByUserId(userId)
	if player then
		-- Get the handler function associated with the developer product ID and attempt to run it
		local handler = productFunctions[productId]
		local success, result = pcall(handler, receiptInfo, player)
		if success then
			-- The user has received their benefits!
			-- return PurchaseGranted to confirm the transaction.
			return Enum.ProductPurchaseDecision.PurchaseGranted
		else
			warn("Failed to process receipt:", receiptInfo, result)
		end
	end
end

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