InvalidCastException: Cannot cast from source type to destination type. ???

hey, i have no idea what is causing this;

function Update ()
{
    if(Input.GetButtonDown("Jump") && isShooter)
    {
        transform.DetachChildren();
        isShooter = false;
        var Ditched : GemScriptV2 = gameObject.GetComponentsInChildren(GemScriptV2);
            Ditched.ditched = true;
    }
}

the var ditched line is the line where the error is coming from :S

Try casting the component you're referencing:

var Ditched : GemScriptV2 = gameObject.GetComponentsInChildren(GemScriptV2) as GemScriptV2;

var Ditched is of type GemScriptV2.

gameObject.GetComponentsInChildren(GemScriptV2) returns an array of Component.

You cannot cast Component[] to GemScriptV2.

Try this:

function Update ()
{
    if(Input.GetButtonDown("Jump") && isShooter)
    {
        transform.DetachChildren();
        isShooter = false;
        var Ditched : GemScriptV2 = gameObject.GetComponentInChildren.<GemScriptV2>();
        Ditched.ditched = true;
    }
}