I need help toggling a main menu button.

I am trying to make a main menu button that toggles VSync. I am also trying to make it change the text for a text mesh.
This is my script:

var VSyncButton = false;

function OnMouseEnter()
{
    //Change the color of the text
    renderer.material.color = Color.green;
}

function OnMouseExit()
{
    //Change the color of the text
    renderer.material.color = Color.white;
}

function OnMouseUp()
{

if ( VSyncButton )
    {
    QualitySettings.vSyncCount = 1;
    GetComponent(TextMesh).text = "VSync: True";
    }

}

How would the VSync count be toggled? I tried different methods but none of them worked…

If I understand your question, is it just a matter of adding an else statement?

if ( VSyncButton ) 
{ 
    if( QualitySettings.vSyncCount == 0 )
    {
        QualitySettings.vSyncCount = 1;
        GetComponent(TextMesh).text = "VSync: True";
    }
    else
    {
        QualitySettings.vSyncCount = 0;
        GetComponent(TextMesh).text = "VSync: False";
    }
}

function OnMouseUp() {

if ( VSyncButton ) {
            QualitySettings.vSyncCount = 1;
            GetComponent(TextMesh).text = "VSync: True";
        }
        else
        {
            QualitySettings.vSyncCount = 0;
            GetComponent(TextMesh).text = "VSync: False";
    }
}