Pretty sure that’d break the argument since :GetPlayerByUserId
Your parameter does the job, it’s getting the id of the player from your parameter, i don’t think you’d want to get the id from an id…?
I tried got this error: Argument 1 missing or nil
also it errors that line
Changed the structure of the script through a tutorial, still doesn’t print 2 but only prints 1.
local marketplaceService = game:GetService("MarketplaceService")
print("1")
marketplaceService.ProcessReceipt = function(receiptInfo)
print("2")
local players = game.Players:GetPlayers()
local done = 0
for i=1,#players do
if players[i].userId == receiptInfo.PlayerId then
if receiptInfo.ProductId == 1086221671 and done == 0 then
done = 1
players[i].leaderstats.Stage.Value = players[i].leaderstats.Stage.Value + 1
players[i].TeleportedStage.Value = players[i].leaderstats.Stage.Value
players[i].Character:MoveTo(game.Workspace.Stages:FindFirstChild(players[i].TeleportedStage.Value).Position)
done = 0
end
end
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
local player = game.Players.LocalPlayer
local productId = 1086221671
script.Parent.MouseButton1Click:Connect(function()
script.Parent.SkipStageScript.Click:Play()
game:GetService("MarketplaceService"):PromptProductPurchase(player, productId)
end)