How do you Place/Spawn a GameObject or Prefab in front of Player

Hello, I am making a game where Player can pick up “walls” just like picking up coins or points. I am trying to have it so if the player has say “2 walls” than he can hit the ‘1’ or ‘e’ keys and a wall GameObject or Prefab will appear in front of the character. I need help with the code I don’t know where to start or anything. Here is the code for my Wall pickup (This code is on the Player)

var PlayerScore : int;
var ScoreText = "Walls: 0";
var MaxPoints : int;
var gText : GUIText; 

function OnTriggerEnter(other : Collider){
    if(other.tag == "Point"){
       PlayerScore += 1;
       ScoreText = "Walls: " + PlayerScore;
       Destroy(other.gameObject);
    }
}

function Update(){
    if(PlayerScore > MaxPoints){
       PlayerScore = 0;
       print("MaxReached");
       ScoreText = "Walls: 0";
    }
    gText.text = ScoreText; 
}

Please help me with the code for placing the GameObject in front of the Player. Do I need to make a new JavaScript or addon to this Wall one. If it is a new Javascript where do I add it to? Thank you for your time, I would appreciate any help I can get.

Here. Use this as a separate script just for testing. Attach this UnityScript to your player. Drag a prefab or other object onto the slot for (Prefab Object) in the inspector. When you press ‘E’, it will instantiate that object 3 units(default) in front of the player. You can take this and tweak it to your needs, and add what you need from it to your script. You can enable and disable the boolean “CanPlaceObject” via your player’s “Wall Score”. Something like

if(PlayerScore > 0)
    canPlaceObject = true;
else if(PlayerScore <= 0)
    canPlaceObject = false;

That’s just an example. Here is my script.

    public var prefabObject : GameObject;
    var canPlaceObject : boolean = true;
    private var offset : Vector3;
    private var fwd : Vector3;
    private var clone : GameObject;
    var unit : float = 3.0f;
    
    function Update()
    {
        fwd = transform.TransformDirection(Vector3.forward) * unit;
        offset = transform.position + fwd;
        if(Input.GetKeyDown(KeyCode.E) && canPlaceObject)
        {
            clone = Instantiate(prefabObject, offset, transform.rotation);
        }
    }

you can add the following to this script

private var playerPos:Vector3;
private var spawnPos:Vector3;
public var player: GameObject;
public var objectToInstantiate: GameObject;

function DoInstatiate(){
playerPos=player.transform.position;
spawnPos= Vector3(playerPos.x+10, playerPos.y, playerPos.z); ///change as needed
Instantiate (objectToInstantiate, spawnPos, Quaternion.identity);
}

then just call this function when you wish to create the object