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

How do you make a skip a stage gui pass? Everytime I make it, it does not work?

Asked by 8 years ago

When I make this it does'nt work am I suppose to make it in the gamepass store? or what? an someone please help? if so join me my username is "dizzycat11"!

0
Thanks! I accidentally made a gamepass instead of developer product, Thanks! dizzycat11 20 — 8y
0
Np MrMinecraft998887 87 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago
Edited 8 years ago

SETUP: First, Make a team for each of your levels and name it Level 1, Level 2, ... and so on. Add an IntValue to every Team and name the IntValue "LevelNumber". Make the IntValue's Value equal the number in the name of the team. Now that we are done with the setup we can get onto the script. :D SCRIPT:

------------------------------------------------------------------------------------------------------
--LocalScript in StarterPack
-- setup local variables
local buyButton = game.Workspace.BuyButton.SurfaceGui.TextButton -- Make a Part and name it BuyButton, Insert a SurfaceGui, and Insert a TextButton into that.
local productId = 20518668 -- Make a DeveloperProduct (Not a GamePass) and Change the numbers to the ProductId of your Developer Product

-- when player clicks on buy brick prompt him/her to buy a product
buyButton.MouseButton1Click:connect(function()
    game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, productId)
end)
------------------------------------------------------------------------------------------------------
--Script in BuyButton part
-- setup local variables
local MarketplaceService = Game:GetService("MarketplaceService")
local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
local productId = 20518668 -- Once again change the numbers to your DeveloperProductId

-- define function that will be called when purchase finished
MarketplaceService.ProcessReceipt = function(receiptInfo) 
    -- find the player based on the PlayerId in receiptInfo
    for i, player in ipairs(game.Players:GetChildren()) do
        if player.userId == receiptInfo.PlayerId then
            -- check which product was purchased
            if receiptInfo.ProductId == productId then
                -- handle purchase
                player.Team.LevelNumber.Value = player.Team.LevelNumber.Value + 1
            end
        end
    end 
    -- record the transaction in a Data Store
    local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_purchase_" .. receiptInfo.ProductId
    ds:IncrementAsync(playerProductKey, 1)  
    -- tell ROBLOX that we have successfully handled the transaction
    return Enum.ProductPurchaseDecision.PurchaseGranted     
end

If this helped, please hit Accept This Answer underneath my name. :D

Ad

Answer this question