What is the simplest way to move an object towards where it is facing ?

I use this script to move my object around my map :

        if (Input.GetKey (KeyCode.W)) 
			transform.position += transform.forward * speed * Time.deltaTime;
		if (Input.GetKey (KeyCode.A))
			transform.position -= transform.right * speed * Time.deltaTime;
		if (Input.GetKey (KeyCode.D))
			transform.position += transform.right * speed * Time.deltaTime;
		if (Input.GetKey (KeyCode.S))
			transform.position -= transform.forward * speed * Time.deltaTime;

It does work but when I am changing the direction with my mouse :

        float horizontal = Input.GetAxis("Mouse X") * rotateSpeed;
		target.transform.Rotate(0, horizontal, 0);
		
		float desiredAngle = target.transform.eulerAngles.y;
		Quaternion rotation = Quaternion.Euler(0, desiredAngle, 0);
		transform.position = target.transform.position - (rotation * offset);
		
		transform.LookAt(target.transform);

The Object still moves on the same axis when I press W.

what your looking for is transform.TransformVector

This is an example

	float speed = 5f;
            float rotationSpeed =5f;
            void Update ()
	{
			float rotation = Input.GetAxis ("Mouse X");
			transform.Rotate (0, rotation * rotationSpeed, 0);

			float horizontal = Input.GetAxis ("Horizontal");
			float vertical = Input.GetAxis ("Vertical");
			
			Vector3 move = new Vector3 (horizontal, 0, vertical);
			move = transform.TransformVector (move).normalized;
			move *= speed;
			move.y = GetComponent<Rigidbody>().velocity.y;
			
			GetComponent<Rigidbody>().velocity = move;
	}