Instantiate as children of GameObject hit by raycast.

I have made a script that instantiates a prefab at the location of a raycasthit. But how can i make it so this prefab also becomes a children of the gameobject it hits. So it will move with the gameobject.

My code looks like this do far:

var linePrefab : GameObject;
var decalPrefab : GameObject;

function Shoot ()
    {
        var rayDirection = SprayDirection(shotSpread);

        if(Physics.Raycast(transform.position, rayDirection, hit, range)) {

            if(hit.distance > minTrailDistance){
                newLineObject = Instantiate(linePrefab);
                newLine = newLineObject.GetComponent(LineRenderer);

                newLine.SetPosition(0, transform.position);
                newLine.SetPosition(1, hit.point);
            }

            Instantiate(decalPrefab, hit.point, Quaternion.LookRotation(hit.normal));//This instantiates the prefab i want to make a child of the raycasthit object.

            hit.collider.gameObject.SendMessage("Damage", damage, SendMessageOptions.DontRequireReceiver);

            if (hit.rigidbody){
                hit.rigidbody.AddForceAtPosition(rayDirection * force,hit.point);
            }
        }
    }

You need to capture the result returned by your Instantiate function in a variable. The result returned by a call to Instantiate is a reference to the newly instantiated item.

Once you've got this reference in a variable, you can then manipulate it using that variable as shown below:

//This instantiates the prefab i want to make a child of the raycasthit object:
var decalInstance : GameObject = Instantiate(decalPrefab, hit.point, Quaternion.LookRotation(hit.normal));

//This parents the object to the object which was hit:
decalInstance.transform.parent = hit.transform;

I have been searching all over for this solution. thx!! :D