I want to change the color of game object, but when i am applying this script my object looks corrupted and this script also doesn't work.

var target : GameObject;

function Update(){
if(Input.GetKeyDown(KeyCode.UpArrow))
{ target.transform.renderer.material.color=Color.yellow; }
if(Input.GetKeyUp(KeyCode.UpArrow))
{target.transform.renderer.material.color=Color.grey; }
}

PS: please tell me how to convert RGBA into float to use my own color.

Color color= new Color(129 / 255f, 127 / 255f, 127 / 255f, 127 / 255f);