can't move player rigidbody.velocity

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Obstacle : MonoBehaviour {
Rigidbody2D rb ;
public float moveSpeed ;
private void awake () {
GetComponent () ;
}
private void fixedUpdate ()
{
GetComponent ().velocity=( Vector2.left * moveSpeed);

}

void Update () {
	if (transform.position.x < -5f)
		Destroy(gameObject);
	
}

}

You are using GetComponent() the wrong way. This is probably what you want to do:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Obstacle : MonoBehaviour {
    Rigidbody2D rb;
    public float moveSpeed;
    
    private void awake () {
        rb = GetComponent<Rigidbody2D> () ;
    }

    private void fixedUpdate () {
        rb.velocity = Vector2.left * moveSpeed;
    }

    void Update () {
        if (transform.position.x < -5f)
            Destroy(gameObject);
    }
}

always remember to specify which component you want to get and assign it to the variable. Then just use the variable. Hope it helps and if it does mark as accepted ; )