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

'Skip Stage' Script doesn't work- there are no errors in the output. Help?

Hello, my friend and I have had trouble trying to fix a 'Skip Stage' script.

There is a separate LocalScript in the GUI that works fine- however the following code seems to have an error that doesn't display in the output.

If you can spot it, please tell me or leave me some tips on how to prevent this further. Thanks.

local MarketplaceService = game:GetService("MarketplaceService")

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

local currency = "Stage"

local done = 0

for i,v in pairs(game.Players:GetChildre()) do
    if i.userId == receiptInfo.PlayerId then
        if receiptInfo.ProductId == 976013381 or 976013480 or 976016228 or 976018199 and done == 0 then 
            done = 1
            i.leaderstats.Stage.Value = i.leaderstats.Stage.Value + 1
            i.Character.Humanoid.Health = 0
            done = 0
            return Enum.ProductPurchaseDecision.PurchaseGranted
            end
        end
    end
end

1 answer

You should be able to understand what your using but try using this it has -1 for a reason

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 == 976013381 or 976013480 or 976016228 or 976018199 and done == 0 then
			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

4 comments

0

Hello, I found the script quite unhelpful. What is the reason for -1? It didn't seem to help but thanks for your time.

0

It works for me you must not have a working checkpoint system

0

Hello, thanks for your response. Please send me a video with you using said script and it working accurately. Thanks.

0

Text me on discord FreedomDucky#0001

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