I tried to do this in a LocalScript, but it does not work and I can't figure out why because it doesn't throw any errors. Please help!

script.Parent.MouseButton1Click:connect(function()
	if game.Players.LocalPlayer.items.numPagesInv.Value == 1 then
		game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, script.Parent.devId.Value)
		game:GetService("MarketplaceService").ProcessRecepit = function(receiptInfo)
			if receiptInfo.ProductId == script.Parent.devId.Value then
				game.Players.LocalPlayer.items.numPagesInv.Value = game.Players.LocalPlayer.items.numPagesInv.Value + 1
			end
		end
		return Enum.ProductPurchaseDecision.PurchaseGranted
	elseif game.Players.LocalPlayer.items.numPagesInv.Value == 2 then
		script.Parent.Parent:TweenPosition(UDim2.new(-1, 0, .15, 0), "Out", "Sine", .5, true)
		wait(.7)
		script.Parent.Parent.Parent.page2:TweenPosition(UDim2.new(0, 0, .15, 0), "In", "Sine", .5, true)
	end
end)