The Avestan script is a deliberate act of phonetic engineering. The Avesta, the liturgical corpus of Zoroastrianism, had been transmitted orally by priestly schools for something like a thousand years, in a language that had long ceased to be spoken, before the script was created to fix it in writing, most likely between the fourth and sixth centuries CE under the Sasanian dynasty, whose priesthood was then consolidating the canon.
The base material was the Pahlavi cursive of administrative use, a notoriously ambiguous script, but the designers inverted its vices: where Pahlavi wrote many sounds with one sign, the Avestan alphabet wrote one sound per sign, expanding to more than fifty letters, with distinct characters for fine shades of vowels and consonants that ordinary scripts ignore. The reason is theological.
In Zoroastrian ritual the recited sound of the sacred words, the manthra, is itself operative, so a text that fixed the words but not their exact pronunciation would have missed the point. Written right to left like its Aramaic-descended relatives, the script is called din dabireh, the religion writing, in the tradition, and it was used for essentially nothing except the sacred corpus and its ritual apparatus, one of the purest special-purpose scripts ever devised.