On Hit go up?

I want to create a script where when a ball hits a wall it will move on the y axis. how would I do that?
Im using C# so I cant do

if (collision.gameObject == wall)

You should post the code! Anyway, supposing collision is a Collision generated on the OnCollisionEnter event, you could compare the collided object’s name or tag:

void OnCollisionEnter(Collision collision){
  if (collision.gameObject.name == "wall"){
  // do whatever you want
  }
}

You must of course rename the object to “wall”. You can also use gameObject.tag instead of gameObject.name - you must set the object tag to “wall” at the Inspector, in this case.

What is the error. Also could you post entire script?