Radio sound script - how?

Hi,
I have a radio in my game which should play a sound if I run against it. I finally wrote a script which doesn’t work. Because the point is: How can I get the radio to play a sound and NOT the first person controller?
Here’s the script so far:

function OnControllerColliderHit(hit:ControllerColliderHit) {
if(hit.gameObject.tag == “Radio”) {
sound_on();
}
}

function sound_on() {
var radio = gameObject.FindWithTag(“Radio”);
radio.audio.PlayOneShot(sound);
}

The radio has the tag “Radio”.

Greet
Dave

Maybe

private var radio : GameObject;

function Start(){
//Store your tag into the private var
}


function OnControllerColliderHit(hit:ControllerColliderHit) { 
if(hit.gameObject.tag == "Radio") { 
radio.sound_on(); 
} 
}

And have this on a seperate script on radio obj.

{code}

function sound_on() {

radio.audio.PlayOneShot(sound);
} [/code]

just an approach -untested

HTh
AaronC

Thanks for your support, but what do you mean with “Store your tag into the private var”? Could you give an example, please?

Dave