Can someone please help me with changing this script?

Hello, my last post was about making a skip-stage button for my obby. A person responded with 2 scripts and I’m really thankful for that. The only problem is that I forgot to mention I wanted the skip-stage-script to function without a gamepass. He sent me this:

Make a Script in ServerScriptService
and put this
,
MarketplaceService = game:GetService(“MarketplaceService”)

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

local currency = “Stage”

local done = 0

for i = 1,#players do
if players[i].userId == receiptInfo.PlayerId then
if receiptInfo.ProductId == 978487374 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
,

make a gui button in ScreenGui add local script and put this

,
local productId = 978487374 – Change to the ID of your developer product.
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:connect(function()
game:GetService(“MarketplaceService”):PromptProductPurchase(player, productId)
end)

,

I want to know what I need to remove/change to make the script work without gamepass, so that when someone presses the button, he/she gets to the next stage.

1 Like