You can give a try with the layer.index.
thisComp.layer(1).transform.scale;
I guess you defined :
layer.name=« toto »;
So use thisComp.layer(« toto »).property(« ADBE transform » ).property(«ADBE Scale »).setValue(1).
(I think it’s better to use the proper names in case you share your script to a non-English person.)
Anyway, reading your post, I just want to have a precision : do you try to catch layers inside a precomp ?
Cheers,