i followed a tutorail for this and it dosen't work.

Hey! Please use code-tags in the future: Using code tags properly

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

public class playermovement : MonoBehaviour{

public CharacterController2D controller;

public float RunSpeed = 40f;

float HorizontalMove = 0f;

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

}

// Update is called once per frame
void Update() {

HorizontalMove = Input.GetAxisRaw("Horizontal") * RunSpeed;

}

void FixedUpdate()
{
// move our character
controller.Move(HorizontalMove * Time.fixedDeltaTime, false, false);
}
}

You have created a field for the controller, but you have not set it to an instance.
Either you drag in the controller in the inspector or you add the following line inside your Start() method:

controller = GetComponent<CharacterController2d>();