You should put the  at the end of the first statement.
As soon as it encountered the , the expression did an implicit look up of the value() of transform.position, which returned a 2 or 3 dimensional array, of which it yielded the first thd element.
Consequently it interpreted the rest of the statement as if you were asking .valueAtTime() of a number, which is not a function, I guess. ☺
so to recap: x=thisComp.layer(index-1).transform.position.valueAtTime(time);