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.

This is a repost due to me getting no other answer then a troll.

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 comment

0

Please message me via Discord FreedomDucky#0001 Ill figure out the problem the script is perfect

1 answer

There's a few issues within your script. Your first issue is that you used ":GetChildre()" instead of ":GetChildren()" on line 10. A lesser issue is that "return" won't do anything. It's reserved for functions so you can just remove that useless line (unless you are specifically calling a RemoteFunction to give back a successful purchase to your LocalScript).

More importantly, "MarketplaceService.ProcessReceipt = function(receiptInfo)" is actually a function; you aren't supposed to set it as a function! It's more like "purchased = MarketplaceService.ProcessReceipt(receiptinfo)" where "purchased" is a "Enum.ProductPurchaseDecision" value which either returns ".PurchaseGranted" as true or false (so check if purchased == Enum.ProductPurchaseDecision.PurchaseGranted if you want to know if the player has already bought the product).

That's as far as I can see. Some things I'm just assuming what they are such as "recieptInfo".

If you have any questions or issues contact me. ;)

1 comment

0

Hey, I'm still confused. Could you add me?

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