How to add particle effects to a FPS

I am in a entry level video game design class, and one of our assingments is creating a simple first person shooter game. While its not required, I want to add some particle effects to it. The sparks effect on the gun barrel for every time a shot is fired and the small explosion effect for targets that are hit. My instructor will only give me crude hints as how to do this (since the next course is supposed to cover scripting more) and I have not been able to find a clear refference here on the Unity website.

How would I script these?

This is the javascript I am using so far for the shots fired and target destroy.

function Start () {

var projectile : Rigidbody;
var speed : float = 75;
var fire : AudioClip;

function Update () {
var instantiatedProjectile : Rigidbody = Instantiate(projectile, transform.position +
Vector3(0,-0,0), transform.rotation);
instantiatedProjectile.velocity = transform.TransformDirection(Vector3(0,0,speed));
Physics.IgnoreCollision(instantiatedProjectile.collider, transform.root.collider);


function Start () {

var hitTarget : AudioClip;

function OnTriggerEnter (other : Collider) {
AudioSource.PlayClipAtPoint (hitTarget, Camera.main.transform.position);


Thanks in advance.
Also, what is a good source for learning how to script in unity?

For particles use the ‘particle emission’ component.

And make sure you use ‘Code Sample’ to post your code, otherwise it looks awful (your posted code is impossible to read).