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

Skip stage button on obby increases stage value but doesn't tp me to stage spawn point?

Here's the script for the dev product: ~~~~~~~~~~~~~~~~~ local productId = 915594981 local player = game.Players.LocalPlayer script.Parent.MouseButton1Click:connect(function() game:GetService("MarketplaceService"):PromptProductPurchase(player, productId) end)


Here's the things to skip the stage:~~~~~~~~~~~~~~~~~
MarketplaceService = game:GetService("MarketplaceService")

MarketplaceService.ProcessReceipt = function(receiptInfo)
players = game.Players:GetPlayers()

currency = "Stage"

done = 0

for i=1,#players do
    if players[i].userId == receiptInfo.PlayerId then
        if receiptInfo.ProductId == 915594981 and done == 0 then
            done = 1
            players[i].leaderstats[currency].Value = players[i].leaderstats[currency].Value + 1
            players[i].Character.Humanoid.Health = 0
            done = 0
        end
    end
end
return Enum.ProductPurchaseDecision.PurchaseGranted 
end

Whenever I buy the product, it increases my stage value, but it won't teleport me to the spawn point of that stage.

2 comments

0

srry first time posting didnt understand the code block feature

0

Why obbies.. It's just like a virus lol

1 answer

I don't see you teleporting the player anywhere in your script.

What I see you trying to do is set the stage to [current+1], and then killing the player, which is not an extremely effective way of doing it. Personally, I would alter the player's CFrame like so..

MarketplaceService = game:GetService("MarketplaceService")

MarketplaceService.ProcessReceipt = function(receiptInfo)
players = game.Players:GetPlayers()

currency = "Stage"

done = 0

for i=1,#players do
    if players[i].userId == receiptInfo.PlayerId then
        if receiptInfo.ProductId == 915594981 and done == 0 then
            done = 1
            players[i].leaderstats[currency].Value = players[i].leaderstats[currency].Value + 1
            game.Workspace[players[i].Name]:WaitForChild("HumanoidRootPart").CFrame = CFrame.new([Spawn Position] + Vector3.new(0,3,0))
            done = 0
        end
    end
end
return Enum.ProductPurchaseDecision.PurchaseGranted 
end

Of course, change [Spawn Position] on line 15 to the position of the stages spawn point.

The change made is on line 15. I took out you killing the player, and teleported them to the spawn point instead.

5 comments

1

You may have to view source code to see all of the code on line 15.

0

It did not teleport to the spawn point. I replaced [Spawn Position] with the coords of the spawn point.

1

Does it do anything?

0

It doesn't even increase stage number

1

That does not make much sense. I only changed line 15, and from what I can tell, it should not affect line 14 at all, unless an error is thrown which you have not said is the case.

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