simple 2d controller with a and d.

I need help making a 2d survival game and I need this script just to even make it a working game I’ve tried many scripts but they all failed this is my last resort please help me out.

This should do the trick, make sure the script is attached to the player

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

public class Testing : MonoBehaviour
{
    public Rigidbody2D playerRB;

    public float movmentSpeed = 10f;

    private void Start()
    {
        playerRB = GetComponent<Rigidbody2D>();
    }

    private void Update()
    {
        if(Input.GetKey("a"))
        {
            playerRB.velocity = new Vector2(playerRB.velocity.x * movmentSpeed * Time.deltaTime, playerRB.velocity.y);
        } else if(Input.GetKey("d"))
        {
            playerRB.velocity = new Vector2(playerRB.velocity.x * -movmentSpeed * Time.deltaTime, playerRB.velocity.y);
        }
    }
}