Velocity based on rotation

Hi so im trying to take a gameobject and make its velocity follow whatever rotation it has.

Ex: its at a 45 degree angle it travels diagonal , its rotation is 90 so it travels horizontal etc.

right now my code only make is so that all things travel to the up ( because of transform.forward), is there a simple solution to my problem? thanks

var rot : Quaternion;

	rot = Quaternion.Euler(0, player.transform.rotation.y,0);
	
	transform.rotation = rot;
	
	rigidbody.velocity = transform.forward * speed;

I think this line: rot = Quaternion.Euler(0, player.transform.rotation.y,0); should be:

rot = Quaternion.Euler(0, player.transform.eulerAngles.y,0);