what is this script supposed to do?

I have this script which i wrote myself which i think is supposed to play an animation when i press p but it dosent work can anyone help me out with this?

if(Input.GetKey("p"))
animation.Play("Wave");

You need to wrap this into the Update function, otherwise it will be executed only once (if at all).

Secondly, in Update, GetKey() will be called every frame as long as you hold down the ā€˜pā€™ key, trying to play the animation every frame. Use GetKeyDown() instead:

function Update(){
    if(Input.GetKeyDown("p"))
        animation.Play("Wave");
}

After that, attach the script to the object that has the animation.