Delete duplicate elements from an array in UnityScript

If you find my question as a duplicate question, please post the link to the answer also, I didn’t find a proper solution to my problem here. That’s why the question is asked below. My problem is given in the code below:

var Speed1:float;
var Speed2:float;
var Speed3:float;
var Speed4:float;

var MaxStateTimer:float;
var MinStateTimer:float;

private var StateArray:Array;

private var StateTimer:float;

private var TaskValue1:float=70;
private var TaskValue2:float=90;
private var TaskValue3:float=100;
private var TaskValue4:float=100;

function Start()
{
    StateArray=new Array();
    StateTimer=Random.Range(MinStateTimer,MaxStateTimer);
}
function Update()
{
    TaskValue1=Speed1*Time.deltaTime;
    TaskValue2=Speed2*Time.deltaTime;
    TaskValue3=Speed3*Time.deltaTime;
    TaskValue4=Speed4*Time.deltaTime;

    StateTimer-=Time.deltaTime;
    if(StateTimer<=0)
    {
        StateTimer=Random.Range(MinStateTimer,MaxStateTimer);
        if(TaskValue1<=60)
        {
            //I need to add a number 1 to the array StateArray.
        }
        if(TaskValue2<=60)
        {
            //I need to add a number 2 to the array StateArray.
        }
        if(TaskValue3<=60)
        {
            //I need to add a number 3 to the Array StateArray.
        }
        if(TaskValue4<=60)
        {
            //I need to add a number 4 to the array StateArray.
        }
        //1) Now from these numbers in the array, I need to remove all the duplicate elemets in the array.
        //After removing duplicate elements, I need to randomly select a number from the list of numbers in the array StateArray
        // if the randomly selected number is 1, i have to do task1 if random number selected is 2 do task2 if random number selected is 3 do task3
        //
        
        //I tried several methods but all were giving errors. I need to know how to remove duplicate elements from the StateArray.
        //After removing duplicate numbers from the StateArray, ho do I select a random number from the Array.

    }
   
}

Simple way:

     bool a,b,c,d;

     if(TaskValue1<=60)
     {
         if(a == false){
             //I need to add a number 1 to the array StateArray.
             a = true;
         }
     }
     // Same for others with appropriate boolean.