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

how do i make process receipt work?

This is what i have on a server script. I have an error on line 3

local marketserv = game:GetService("MarketplaceService")

marketserv.ProccessReceipt:connect(function(purchaseinfo)
	local plr1 = game.Players:GetPlayerByUserId(purchaseinfo.PlayerId)
	local cash = plr1.leaderstats.Cash
		if purchaseinfo.ProductId == 270172519 then
			cash.Value = cash.Value + 100
		end
	
end)

1 answer

Don't use :connect (or :Connect) for this, also you didn't set a return value!

local marketserv = game:GetService("MarketplaceService")

function marketserv.ProccessReceipt(purchaseinfo)
    local plr1 = game.Players:GetPlayerByUserId(purchaseinfo.PlayerId)
    local cash = plr1.leaderstats.Cash
        if purchaseinfo.ProductId == 270172519 then
            cash.Value = cash.Value + 100
	return Enum.ProductPurchaseDecision.PurchaseGranted	--> Any code after this won't run, unless the code doesn't get runned.	
        end
end

3 comments

0

this still doesn't give the player money

0

can you use prints to find where the problem is?

0

not even the function fires

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