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

Obby skip stage not working?

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

✓ Accepted answer

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)

2 comments

0

Testing

0

uh dos it work

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.

1 comment

0

It is not working can you try remake?

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.

1 comment

0

Not working.

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