store script in file

I see in another thread that the store script command is broken in AS ObjC. I’d really love to see a discussion of alternatives to this.

tell current application
	store script scriptObject in file pathToFile replacing yes

-- Error [-1700] Can't make «script» into type script.

You should be able to add OSAKit.framework and use its writeToURL:ofType:usingStorageOptions:error:.