Velocity in rigidbody2d is not doing anything.

I’m trying to make my jump when the W key is pressed. I’m going to achieve this with the rigidbody2D.velocity route since the game is 2D. Here’s my code.

//jumping
	if(canJump == true){
	rigidbody2D.velocity.y =10;
	Debug.Log("This shows up");
	

	}
	}
	
	
	
	 function OnCollisionStay2D(coll: Collision2D) {
	 	
	 	if(coll.gameObject.tag == "Terrain" && Input.GetKeyDown(KeyCode.W)){
	 canJump = true;
	 	
	 
	 }
	 else{
	 	canJump = false;
	 }
	 }

Anyways, when I press W, the debug log string shows up, but the rigidbody.velocity = 10 is not seeming to have an effect. What is wrong? Thank you!

use rigidbody2D instead of Rigidbody2D.
also if you’re using c# you can’t set the velocity y value by itself.
you need to do:

rigidbody2D.velocity = new Vector2(rigidbody2D.velocity.x,3);