Vehicle help

I already asked this question before on another user, but i was kinda vague. My problem is is than i need a vehicle to make sounds. Plain and simple: i need a c# of java script file to tell the game to play a mp3 file called truck upon pressing w a s and d keys. I tried a guess at it:`#include truck.mp3
if (Input.GetKeyDown(“w”))
truck.mp3 = true;
if (input.GetKeyDown(“w”))
truck.mp3 = false;

i am posotive that is wrong, but it is my best shot lol. i tried it and it didn’t work.
also that’s only for the w key. anyway can somebody help me?

It’s pretty simple:

  • add an audiosource to your truck instance <= this is the object responsible for managing audio events.
  • drag the truck audio clip into the audiosource’s audioclip slot.
  • on ‘input’, use the audioclip property of the audiosource component to play, stop, etc.