Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
	MarketplaceService = game:GetService("MarketplaceService")

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

	local currency = "Stage"
	

local done = 0

for i=1,#players do
	if players[i].userId == receiptInfo.PlayerId then
			if receiptInfo.ProductId == 1120029971 and done == 0 then
				done = 1
				local Stage = players[i].leaderstats.Stage.Value
				players[i].leaderstats[currency].Value = players[i].leaderstats[currency].Value + 1
				players[i].Character.Humanoid.Health = 0
				local StagePart = workspace.Stages:FindFirstChild(Stage.Value)
				

				local Humanoid = character:WaitForChild("Humanoid")
				local Torso = character:WaitForChild("HumanoidRootPart")

				wait()

				if Torso and Humanoid then
						

					local StagePart = workspace.Stages:FindFirstChild(Stage)
					character:MoveTo(StagePart.Position)
				end
			done = 0
		end
	end
end
return Enum.ProductPurchaseDecision.PurchaseGranted	
end``

1 comment

0

I have no idea how to figure this out, if anyone can come up with an answer that would be great.