Sanskrit originated as an oral language i.e. it was never penned down for the most of it's life. Hence, it doesn't have a writing system of it's own. During it's life cycle, various scripts have been used to write Sanskrit including many regional Indian tongues and most recently Roman script .
The earliest occurrence of Sanskrit in written form is in Brahmi script .
As wikipedia states,
Brahmi evolved into a multiplicity of Brahmic scripts, many of which
were used to write Sanskrit. Roughly contemporary with the Brahmi,
Kharosthi was used in the northwest of the subcontinent. Sometime
between the fourth and eighth centuries, the Gupta script, derived
from Brahmi, became prevalent. Around the eighth century, the Śāradā
script evolved out of the Gupta script. The latter was displaced in
its turn by Devanagari in the 11th or 12th century, with intermediary
stages such as the Siddhaṃ script. In East India, the Bengali
alphabet, and, later, the Odia alphabet, were used.
In the south, where Dravidian languages predominate, scripts used for Sanskrit
include the Tamil, Kannada, Telugu, the Malayalam and Grantha
alphabets.
It is very possible that in Cambodia, Sanskrit was written in Khmer script because Sanskrit has been penned down in the regional tongue/script for millennia.