How do i instantiate a prefab in front of a moving charcter

i am trying to instantiate a prefab in front of my moving character but its not working. Tried my hands with everything av seen online still no result.This is my current code

var target:Transform;
var obstacle:GameObject;
function Start () {

}

function Update () {

}
function OnTriggerEnter(col:Collider) {
if (col.gameObject.tag=="fish"){
Instantiate(obstacle,target.transform.position + target.transform.forward*10,target.rotation);
}
}

Are you sure the collision is even registered? Try putting

print(col.gameObject.tag);

in the first line of your OnTriggerEnter. If nothing is printed, then please check if “Is trigger” is checked in the collider component the object you try to collide with. You also have to have collider or rigidbody component on your character.