When Object Pooling Bullet Decal Arrays in UnityScript, My code use the original prefabs instead of the instantiated cloned prefabs

fairly new to coding and the unity fourms. im having a problem at the moment and i want to know if anyone can help… im object pooling and array of bullet hole decal gameobjects into an array and instantiating a Random gameobject with a specific pooled amount just to test. When I try to place my decals and set them active my code seems to be using the original prefabs in the Hierarchy. When taken out of the hierarchy, they use nothing at all instead of the pooled clones. here is the code snippet

var shotOrigin:Transform;
var shotDirection:Transform;
var shotDistance:float;
var fireRate:float;
var hit : RaycastHit;
var bulletHoleDecals:GameObject[];
var poolAmount = 2;
var triggerDown:boolean;
var Decals:GameObject[];
var vex:Vector3;

function Start () 
{
    var bulletHoleDecals = new Array();
     
    //Debug.Log(bulletHoleDecals.Length);
    triggerDown=false; 
   
    for(var i = 0;i<poolAmount;i++)
    {
        var obj:GameObject=GameObject.Instantiate(Decals[Random.Range(0,2)]);
        obj.SetActive(false);
        bulletHoleDecals.Add(obj);
    }
}

function Update () 
{
    IsShooting();
    Debug.DrawRay(shotOrigin.position,shotOrigin.forward,Color.red);
}

function IsShooting()
{
    
    if(Input.GetAxisRaw("Triggers_360") && triggerDown == false)
    {
        
            if(Physics.Raycast(shotOrigin.position,shotOrigin.forward,hit,shotDistance))
            {
                DrawHoleDecals();
                
                if(hit.collider.tag =="Enemy")
                {
                   
                }

            }
            triggerDown=true;
            
    }
    if(Input.GetAxisRaw("Triggers_360")==0)
    {
        triggerDown=false;
    }
}

function DrawHoleDecals()
{
    
    for(i = 0; i < bulletHoleDecals.Length;i++)
    {
       // bulletHoleDecals*=*

if(!bulletHoleDecals*==false)*
{
Debug.Log(“gotHere”);

//Debug.Log(“gotHere”);

if(Physics.Raycast(shotOrigin.position,shotOrigin.forward,hit,shotDistance))
{
bulletHoleDecals[Random.Range(0,3)].SetActive(true);
bulletHoleDecals[Random.Range(0,3)].transform.position=hit.point;
//(bulletHoleDecals[Random.Range(0,2)],hit.point,Quaternion.FromToRotation(Vector3.up,hit.normal));
bulletHoleDecals[Random.Range(0,3)].transform.rotation=Quaternion.FromToRotation(Vector3.up,hit.normal);
}

break;

}

}

}

At least your DrawHoleDecals() has some strange stuff in it.

 if(!bulletHoleDecals*==false)*

If you want to check which decal is not active yet (not used). use
if (!bulletHitDecals*.activeSelf)*
Then just make sure you set them back to inactive or you’ll run out of decals quickly or have to create a pool of million decals.
You have an unnecessary “var” in the Start() method.
var bulletHoleDecals = new Array();
this makes it so that the array in Start() is a different one from the one you define in the class and use later in DrawHoleDecals . Make it just
bulletHoleDecals = new GameObject[poolAmount];

for(var i = 0;i<poolAmount;i++)
{
var obj:GameObject=GameObject.Instantiate(Decals[Random.Range(0,2)]);
obj.SetActive(false);
bulletHoleDecals = obj;
}
And here…
bulletHoleDecals[Random.Range(0,3)].SetActive(true);
bulletHoleDecals[Random.Range(0,3)].transform.position=hit.point;
//(bulletHoleDecals[Random.Range(0,2)],hit.point,Quaternion.FromToRotation(Vector3.up,hit.normal));
bulletHoleDecals[Random.Range(0,3)].transform.rotation=Quaternion.FromToRotation(Vector3.up,hit.normal);
you take a new random number for each property you change so you might set decal 0 active, move decal 1 to hit.point and rotate decal 2 to correct orientation.
for(i = 0; i < bulletHoleDecals.Length;i++)
{
if(!bulletHoleDecals*.activeSelf)*
{
if(Physics.Raycast(shotOrigin.position,shotOrigin.forward,hit,shotDistance))
{
bulletHoleDecals*.SetActive(true);*
bulletHoleDecals*.transform.position=hit.point;*
bulletHoleDecals*.transform.rotation=Quaternion.FromToRotation(Vector3.up,hit.normal);*

thanks to NoseKills this is the new and improved script for anyone doing object pooling in unity’s javascript along with a short example for raycasting and using decals to make anything from bullets to bloodsplatter appear in your own way the only thing this doesn’t do is add a tiny position change to stop z fighting;

var shotOrigin:Transform;
var shotDistance:float;
//var fireRate:float;
var hit : RaycastHit;
var bulletHoleDecals:GameObject[];
var poolAmount:int;
var triggerDown:boolean;
var vex = new Array();

function Start () 
{
     //bulletHoleDecals = new Array();
     
    
    triggerDown=false; 
   
    for(var i = 0;i<poolAmount;i++)
    {
        var obj:GameObject=GameObject.Instantiate(bulletHoleDecals[Random.Range(0,3)]);
        obj.SetActive(false);
        vex.Add(obj);
    }
    
}

function Update () 
{
    IsShooting();
    Debug.DrawRay(shotOrigin.position,shotOrigin.forward,Color.red);
}

function IsShooting()
{
    
    if(Input.GetAxisRaw("Triggers_360") && triggerDown == false)
    {
        
            if(Physics.Raycast(shotOrigin.position,shotOrigin.forward,hit,shotDistance))
            {
                DrawHoleDecals();
                
                if(hit.collider.tag =="Enemy")
                {
                   
                }

            }
            triggerDown=true;
            
    }
    if(Input.GetAxisRaw("Triggers_360")==0)
    {
        triggerDown=false;
    }
}

function DrawHoleDecals()
{
    
    for(i = 0; i < poolAmount;i++)
    {  
        if(!vex*.activeSelf)*

{

if(Physics.Raycast(shotOrigin.position,shotOrigin.forward,hit,shotDistance))
{

vex*.transform.position=hit.point;*
//this can be useful if you want to change which bullets are set active at a given time [Random.Range(0,2)] for var*.SetActive(true);*
vex*.transform.rotation=Quaternion.FromToRotation(Vector3.up,hit.normal);*
vex*.SetActive(true);*
break;
}

}

}

}