So basically, once I purchase the product for the first time, it makes my level go from 1 to 2 which is good but when I purchase it again it goes from 2 to 4. Why is this happening?

It teleports me to stage 3, but the leaderstat is 4.

local MPS = game:GetService("MarketplaceService")

MPS.ProcessReceipt = function(receiptInfo)
	if receiptInfo.ProductId == 454779976 then
		local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
		local hum = game.Workspace:FindFirstChild(player.Name).Humanoid
		player.leaderstats.Stage.Value = player.leaderstats.Stage.Value + 1
		local newstage = player.leaderstats.Stage.Value
		local newcheckpoint = workspace["Checkpoint "..newstage].Position
		hum.Torso.CFrame = CFrame.new(newcheckpoint + Vector3.new(0,5,0))
	else
		return
end		
end

1 comment

0

Never mind, I forgot to add 'return Enum.ProductPurchaseDecision.PurchaseGranted'