Help with skip stage for the obby I'm working on with my friend

  1. What do you want to achieve? I want to achieve a working skip stage that brings you to the next stage.

  2. What is the issue? The issue is that I stumbled upon some problems. The buying box comes out but it says it’s off-sale.
    robloxapp-20220312-2000373.wmv (693.0 KB)
    The developer product is on-sale, look:

  3. What solutions have you tried so far? I’ve checked out on the DevForum.

I used this script:

MPS = game:GetService("MarketplaceService")
id = 1247673078 --my devproduct id
local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
	MPS:PromptPurchase(player, id)
end)

local MPS = game:GetService("MarketplaceService")

MPS.ProcessReceipt = function(receiptInfo)
	if receiptInfo.ProductId == 1247673078 then
		local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
		player.leaderstats.Stage.Value = player.leaderstats.Stage.Value + 1
		player.Character.HumanoidRootPart.CFrame = "stage block name"
	end
end

If you can help me I would be pleased.

1 Like

try doing it on a server script instead

1 Like

Not even the error comes up if I do it from a normal script

2 Likes

I’m not sure why it is not working. However this may be helpful:

Let me know if it still does not work, then we can figure something else out.
Good luck!

1 Like

Ok thanks! I will check it out

1 Like

You need to use :PromptProductPurchase. You also aren’t ever returning Enum.ProductPurchaseDecision.PurchaseGranted in your ProcessReceipt function so you’ll run into people getting duplicate skip stages and lost robux.

1 Like

No, because they cant even buy it, it says it’s off sale

1 Like

Yes, you’re prompting an asset purchase when you should be prompting a product purchase.

1 Like

Oh, so what should I change in my script then?

1 Like

Change :PromptPurchase to :PromptProductPurchase.

You also need to be handling .ProcessReceipt from a server script.

1 Like

Like this?

MPS = game:GetService("MarketplaceService")
id = 1247673078
local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
	MPS:PromptProductPurchase(player, id)
end)

local MPS = game:GetService("MarketplaceService")

MPS.ProcessReceipt = function(receiptInfo)
	if receiptInfo.ProductId == 1247673078 then
		local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
		player.leaderstats.Stage.Value = player.leaderstats.Stage.Value + 1
		player.Character.HumanoidRootPart.CFrame = "stage block name"
	end
end

Yes but put your MPS.ProcessReceipt handler in a server script.

What’s that meant to mean? Plus, it works now.
image

You have to put this in a server script or else you’ll run into failed purchases

Oh, ok. I’ll try doing it,see if it works

1 Like

Ok. I did that but I can purchase it but not teleport to the next stage

Any errors? Also you should add prints to see what is and isn’t happening.

Like where should I add prints?

At the top of your function and inside your if-statement

I really don’t get the point of prints… :sweat: