this is a simple skip stage button. This script is inside the button itself
local MarketplaceService = game:GetService("MarketplaceService") local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory") local productId = 50041340 MarketplaceService.ProcessReceipt = function(receiptInfo) for i, player in ipairs(game.Players:GetChildren()) do if player.userId == receiptInfo.PlayerId then if receiptInfo.ProductId == productId then local stats = player:WaitForChild("leaderstats") player.leaderstats.Stage.Value = player.leaderstats.Stage.Value + 1 wait() local stage = game.Workspace:WaitForChild(stats.Stage.Value) wait(1) player.Character.Humanoid.Torso.CFrame = stage.CFrame + Vector3.new(0,3,0) end end end local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_purchase_" .. receiptInfo.ProductId ds:IncrementAsync(playerProductKey, 1) return Enum.ProductPurchaseDecision.PurchaseGranted end
This is a localscript inside the starterpack that fires first when a player clicks on the button
local player = game.Players.LocalPlayer local buyButton = player.PlayerGui:WaitForChild("ScreenGui").SkipStage local productId = 50041340 -- 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)
also i'm not sure if it's related i'm using this script to delay the respawn of players after death to allow time for my checkpoint script to run
game.Players.PlayerAdded:connect(function(p) p.CharacterAdded:Connect(function(Character) local Humanoid = Character:FindFirstChild("Humanoid") if Humanoid then Humanoid.Died:connect(function() wait(respawnTime) p:LoadCharacter() end)
Thanks for your time