Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to Manage Developer Products?

Asked by
yak602 10
4 years ago
Edited 4 years ago

Currently I was working on a Skip Stage Developer Product.

I wanted to added multiple Skip stages in increments of such as 1, 5, 25, 50 ETC

I managed to successfully add this as my leader stats increase.

However on my old stage system when I purchased 1 stage skip I would teleport to the stage instantly.

I could write long code with vectors etc etc but I have an easier solution to the problem whereas I don't know where to start.

After the developer product has been purchased how do I make it so the Player resets, aka setting their health to zero making they re spawn at the stage.

Here is my current code

local MPS = game:GetService("MarketplaceService")

MPS.ProcessReceipt = function(receiptInfo)
    if receiptInfo.ProductId == 616370246 then
        local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
        player.leaderstats.Stage.Value = player.leaderstats.Stage.Value + 1
        return Enum.ProductPurchaseDecision.PurchaseGranted

    elseif receiptInfo.ProductId == 667641174 then 
        local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
        player.leaderstats.Stage.Value = player.leaderstats.Stage.Value + 10
        return Enum.ProductPurchaseDecision.PurchaseGranted
    end
end


1 answer

Log in to vote
0
Answered by
yak602 10
4 years ago

Never mind I did it my self,

local MPS = game:GetService("MarketplaceService")

MPS.ProcessReceipt = function(receiptInfo)
    if receiptInfo.ProductId == 616370246 then
        local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
        player.leaderstats.Stage.Value = player.leaderstats.Stage.Value + 1
player.Character:WaitForChild("Humanoid").Health = 0
        return Enum.ProductPurchaseDecision.PurchaseGranted

    elseif receiptInfo.ProductId == 667641174 then 
        local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
        player.leaderstats.Stage.Value = player.leaderstats.Stage.Value + 10
player.Character:WaitForChild("Humanoid").Health = 0
        return Enum.ProductPurchaseDecision.PurchaseGranted
    end
end


I guess coding at 3:30am isn't a good idea I turned really stupid for a second and forgot the basics :P

Ad

Answer this question