How to add a limit for player skipping stage,like I have 5 stages and they can only skip until stage 5

local MPS = game:GetService("MarketplaceService")
MPS.ProcessReceipt = function(receiptInfo)
local x = game.Players:GetChildren()
local done = false

for i=1,#x do
	if x[i].userId == receiptInfo.PlayerId then
		if receiptInfo.ProductId == 0 then
			if done == false then
				done = true
				x[i].leaderstats.Stage.Value = x[i].leaderstats.Stage.Value + 1
				x[i]:LoadCharacter()
				done = false
			end
		end
	end
end

return Enum.ProductPurchaseDecision.PurchaseGranted	

end