Rotation for movement cannot be set in script?

Hello. So in my playermovement script I have this line:

direction = transform.rotation * new Vector3( Input.GetAxis("Horizontal") , 0, Input.GetAxis("Vertical") );

And it doesn’t move me in the direction that I’m facing. Why is this?

In most cases player is directed by the face on an axis z. Then GetAxis define the new direction. Then write so(write on CSharp):

 void Update() {
  Vector3 relativeDirection = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
  Vector3 absoluteDirection = transform.rotation * relativeDirection;
  transform.position += absoluteDirection * Time.deltaTime;
 }

I hope that it will help you.