unexpected Token error

i have no idea how to fix this… my script is:

var range: float = 5; // define the
detection distance
private var hit: RaycastHit;

 function Update(){
   if (Input.GetKeyDown("e")){
     var ray = Camera.main.ViewportPointToRay(Vector3(0.5,0.5,0));
     if (Physics.Raycast(ray, hit, range)){
       // check if the object hit has SoundScript.js:
       var ss: 'SoundScript' = hit.transform.GetComponent(SoundScript);
       if (ss && !audio.isPlaying){ // if so, play its sound:
         audio.clip = ss.soundFX;
         audio.Play();
       
       }
     }
   }
 }

whenever i try to go into play mode i get this…
Assets/sound file lomg.js(9,15): BCE0043: Unexpected token: soundScript.
i have been messing with it for hours but with no success, what do i do?

Well, the error tells you that the problem is on line 9 of your source code. That’s the meaning of the lomg.js(9,15) in the error message. So, we’ve narrowed the problem down to a single line. The compiler says that it doesn’t understand what soundScript is. I am guessing that your line 9 is this one:

var ss: 'SoundScript' = hit.transform.GetComponent(SoundScript);

I don’t know for sure. The compiler complains about soundScript and you only have SoundScript with a capital S. So something is wrong in your question. The use of single quotes around the variable type on that line looks wrong. The example at the bottom of this page:

shows how to use GetComponent correctly.