Please help me, I'm a begginer and I simply can't understand why my character isn't moving.

extends CharacterBody2D

func _physics_process(delta):
	if Input.is_action_pressed("ui_right"):
		velocity.x = 100
	elif Input.is_action_pressed("ui_left"):
		velocity.x = -100
		
	move_and_slide()
  • You made the script, but you didn't attach it to the CharacterBody2D, or you somehow unattached it.
    To attach the script to the CharacterBody2D, it is as simple as drag dropping it.

    Make sure to attach the script that have the movement code.

This code should work!
Do you probably have a Camera2D attached to the CharacterBody2D without drag or smoothing and the scene have no other object? This might give the illusion of not moving.
Otherwise I don't know. Maybe more context can help, but I'm not sure.

    It looks like that script is not attached to the CharacterBody2D node.

    To do that, right-click on CharacterBody2D in the scene tree dock on the left, select Attach Script, and browse to the script file new_gd_script_character.gd.

    After attaching the script, a script icon will appear next to the node. It's the third icon in this picture:

      You made the script, but you didn't attach it to the CharacterBody2D, or you somehow unattached it.
      To attach the script to the CharacterBody2D, it is as simple as drag dropping it.

      Make sure to attach the script that have the movement code.