The script doesn't inherit a native class

Hi, I tried writing a simple 2D player movement script but when I tried to attach it to my player sprite, it just displayed an error message that said “The script doesn’t inherit a native class that can manage a script.” Could anyone help?

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

public class NewBehaviourScript : MonoBehaviour {

    public float Speed = 10f;

    // Start is called before the first frame update
    void Start() {
   
       
    }

    // Update is called once per frame
    void Update() {
   
        float Dirx = Input.GetAxis("Horizontal") * Speed * Time.deltaTime;

        transform.position = new Vector2 (transform.position.x + Dirx, transform.position.y);
    }
}

Make sure the file it is in is named exactly as “NewBehaviourScript.cs”. If it is, try looking for the “.meta” file associated with it and delete it. Unity will recreate it. If it’s not any of this then I am not sure.

Note that this is nothing to do with 2D. For the future, for scriping issues you can use the scripting forum.