Rotating gameobject to velocity

Hello, I’m currently making a game where I need to bounce off the wall and rotate a 2d plane to follow the direction its traveling in (rotation on the z axis). Any help is appreciated.

attach script (C#) with this

void Update()
	transform.rotation = Quaternion.RotateTowards(transform.rotation, Quaternion.LookRotation(rigidbody.velocity, Vector3.up), Time.deltaTime * 10f);

to object you need to rotate. object should have rigidbody to take velocity from it.