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

Obby skip stage not working?

Asked by 3 years ago
Edited 3 years ago

Ok,so I finded a script on youtube and I get a error here is the script and the error:

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 == 1169323090 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

ERROR: Workspace.Script:10: Expected 'do' when parsing for loop, got Unicode character U+200b - Studio - Script:10

3 answers

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

i would use productfinished

game:GetService'MarketplaceService'.PromptProductPurchaseFinished:Connect(function(userId, productId, didBuy)

-- userId is the players userid (player.UserId)
-- productId is the id of product
-- didBuy is if they bought, canceled, or error (true or false)

    if didBuy and productId == 1169323090 then -- think its didBuy. could be if not didBuy
        local player = game.Players:GetPlayerByUserId(userId) -- get player. you have userid  (do somethin like this)
        player.leaderstats.Stage.Value += 1
    end
end)
0
Testing alexandruboc22 12 — 3y
0
uh dos it work BulletproofVast 1033 — 3y
Ad
Log in to vote
0
Answered by 3 years ago

I haven't tested this but try this instead

currency = "Stage"

done = 0

for i,v in pairs(game.Players:GetChildren()) do
    if v.UserId == receiptInfo.PlayerId then
        if receiptInfo.ProductId == 1169323090 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 

Also sorry if I misunderstood that but I think this should work.

0
It is not working can you try remake? alexandruboc22 12 — 3y
Log in to vote
0
Answered by 3 years ago

I haven't tested this but try this instead

currency = "Stage"

done = 0

for i,v in pairs(game.Players:GetChildren()) do
    if v.UserId == receiptInfo.PlayerId then
        if receiptInfo.ProductId == 1169323090 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 

Also sorry if I misunderstood that but I think this should work.

0
Not working. alexandruboc22 12 — 3y

Answer this question