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

Process Receipt Not Working?

I have been trying to make a dev product and when you click it it should teleport. Im using this for an obby skip stage. Please help iv'e been trying to do this for ages.

Script:

local devpro = 0000000 - Devproduct ID
local part = script.Parent

script.Parent.MouseClick:connect(function(player)
game:GetService("MarketPlaceService")PromptProductPurchase(player, productid)



local Marketplaceservice = game:GetService("MarketplaceService")

Marketplaceservice.ProcessReceipt = function(receiptInfo)
	for i, player in pairs (game.Players:GetChildren()) do
		if player.userId == receiptInfo.PlayerId then
		if receiptInfo.ProductId == devpro then
			local torso = player.Character.Torso
			torso.CFrame = CFrame.new(part.position)
		end
	end
end
	return
	Enum.ProductPurchaseDecision.PurchaseGranted
end

1 answer

✓ Accepted answer

I don't know if you occluded the dev ID on purpose, but make sure you put in the correct thing.

I fixed the following:

  • You used a single dash as a comment instead of 2 (- instead of --)

  • You spelt connect wrong. It's supposed to be with an uppercase C.

  • You misspelled MarketplaceService at the onclickevent.

  • You did not use a : before PromptProductPurchase after getting the marketplace service.

  • You never closed the MouseClick function.

  • Your way of getting the player is inefficient, use GetPlayerByUserId

  • Your receipt processing code had broken end statements and the return was at the wrong location.

  • You defined the product ID as "devpro" at the top but later on you use productid, which is thus unset.

local productid = 0000000 -- Devproduct ID
local part = script.Parent
local mps = game:GetService("MarketplaceService")

script.Parent.MouseClick:Connect(function(player)
	mps:PromptProductPurchase(player, productid)
end)


mps.ProcessReceipt = function(receiptInfo)
	local player = Players:GetPlayerByUserId(receiptInfo.PlayerId)
	if receiptInfo.ProductId == devpro then
		local torso = player.Character.Torso
		torso.CFrame = CFrame.new(part.position)

		return Enum.ProductPurchaseDecision.PurchaseGranted;
	end
    return Enum.ProductPurchaseDecision.NotProcessedYet
end

Overall, your code was honestly pretty bad. You should probably enhance your basic knowledge before getting started with more complicated subjects like this.

8 comments

0

Well, no need to be like, Ur coding sucks get better, Jesus so rude. Thanks I guess, try not to be so un motivating to people next time.

0

Thanks tho, I do know basic knowledge bro I have been doing this for a year now so you got nothing to say about me. I just had a problem and didnt know what to do because my speciality is not product ids, but thanks i guess

0

I'm sorry, but if you can't even close off a function, don't know HOW TO USE VARIABLES, cannot correctly spell Connect and have a bunch of broken ends, there's nothing else to say. It wasn't meant to say you are bad at scripting, I said that your current code was bad based on the flaws. I'm not calling you a bad scripter :)

0

It was constructive >advice<. You should enhance your basics, before moving on to more complicated subjects like this, if you make these mistakes.

0

I did not mean to insult you.

0

i know how to do all of that -_- I just was in a hurry, and couldnt correct everything. No need to be rude.

0

Damn dude learn to take some criticism and advice. You can't prove me wrong that the code you provided was bad.

0

dude, I was in a hurry. Cant u understand that? All im saying is that I was in a rush and I couldnt correct everything. Thats why the script was poorly produced,

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