Error I don't understand

I was trying to make a bar’s x coordinate be the same as the x coordinate of the mouse, and I made a script to do it. My problem is that for some reason it keeps giving this error every time I test:

“NullReferenceException: Object reference not set to an instance of an object
ControlV2.Update () (at Assets/ControlV2.cs:22)”

This is the script giving the error:

using UnityEngine;
using System.Collections;

public class ControlV2 : MonoBehaviour
{
    public float speed;
    private Transform t;
            
    void Start ()
    {
        t = GetComponent<Transform> ();
    }
            	
    void Update ()
    {
        Event e = Event.current;
        Vector2 pos = new Vector2 (e.mousePosition.x, -4);
        t.position = pos;
    }
}

Note: This error only happens when I click the play button to test my game. While in the script editor, or after saving it, there are no errors.

Declare some values to public/private variables

public float speed = 2.0f
 private Transform t = new Transform<>();