How can I make my character go forward based on the direction it is facing in 2d C#

I am trying to make my character go forward (up on x axis) whenever I press W. I have tried looking, but everyone said use transform.forward, but that has not seemed to work. Here is my script with transform.forward.

using UnityEngine;

public class MoveRotate : MonoBehaviour {
Rigidbody m_Rigidbody;
public float m_Speed;

void Start()
{
    //Fetch the Rigidbody component you attach from your GameObject
    m_Rigidbody = GetComponent<Rigidbody>();
    
   
}

void Update()
{
    if (Input.GetKey(KeyCode.UpArrow))
    {
        //Move the Rigidbody forwards constantly at speed you define (the blue arrow axis in Scene view)
        m_Rigidbody.AddForce(transform.forward * Time.deltaTime * m_Speed);
    }

    if (Input.GetKey(KeyCode.DownArrow))
    {
        //Move the Rigidbody backwards constantly at the speed you define (the blue arrow axis in Scene view)
        m_Rigidbody.AddForce(-transform.forward * Time.deltaTime * m_Speed);
    }

    if (Input.GetKey(KeyCode.RightArrow))
    {
        //Rotate the sprite about the Y axis in the positive direction
        transform.Rotate(new Vector3(0, 0, -1) * Time.deltaTime * m_Speed, Space.World);
    }

    if (Input.GetKey(KeyCode.LeftArrow))
    {
        //Rotate the sprite about the Y axis in the negative direction
        transform.Rotate(new Vector3(0, 0, 1) * Time.deltaTime * m_Speed, Space.World);
    }
}

}

I can succesfully turn, but can not go forward after that. All help is appreciated!