When entering characters in LineEdit Godot freezes

Let me start by saying that I watched this Hyde And ran into a few problems
1.I found out that the code from this guide is written in godot 3 And I began to correct errors and warnings from the console.
2.After which I launched the application and tried to enter text into LineEdit, I didn’t have time to press enter when I noticed that the application and Godot itself were frozen.

extends Control

@onready var chatLog = get_node("VBoxContainer/RichTextLabel")
@onready var inputLabel = get_node("VBoxContainer/HBoxContainer/Label")
@onready var inputField = get_node("VBoxContainer/HBoxContainer/LineEdit")

var groups = [
		{'name': 'Team', 'color': '#00abc7'},
			{'name': 'Match', 'color': '#ffdd8b'},
				{'name': 'Global', 'color': '#ffffff'}
				]
var group_index = 0
var user_name = 'Player'

func _ready():
	inputField.connect("text_entered", text_entered)
	change_group(0)

func _input(event):
	if event is InputEventKey:
		if event.pressed and event.scancode == KEY_ENTER:
			inputField.grab_focus()
		if event.pressed and event.scancode == KEY_ESCAPE:
			inputField.release_focus()
		if event.pressed and event.scancode == KEY_TAB:
			change_group(1)

func change_group(value):
	group_index += value
	if group_index > (groups.size() - 1):
		group_index = 0
		inputLabel.text = '[' + groups[group_index]['name'] + ']'
		inputLabel.set("custom_colors/font_color", Color(groups[group_index]['color']))

func add_message(username, text, group = 0, color = ''):
	chatLog.bbcode_text += '\n' 
	if color == '':
		chatLog.bbcode_text += '[color=' + groups[group]['color'] + ']'
	else:
		chatLog.bbcode_text += '[color=' + color + ']'
	if username != '':
		chatLog.bbcode_text += '[' + username + ']: '
		chatLog.bbcode_text += text
		chatLog.bbcode_text += '[/color]'

func text_entered(text):
	if text =='/h':
		add_message('', 'There is no help message yet!', 0, '#ff5757')
		inputField.text = ''		
	if text != '':
		add_message(user_name, text, group_index)
		print(text)
		inputField.text = ''

Here is the source code. Thank you for listening!

There is no text_entered signal in Godot 4. It’s called text_submitted now.

extends Control

@onready var chatLog = get_node("VBoxContainer/RichTextLabel")
@onready var inputLabel = get_node("VBoxContainer/HBoxContainer/Label")
@onready var inputField = get_node("VBoxContainer/HBoxContainer/LineEdit")

var groups = [
		{'name': 'Team', 'color': '#00abc7'},
			{'name': 'Match', 'color': '#ffdd8b'},
				{'name': 'Global', 'color': '#ffffff'}
				]
var group_index = 0
var user_name = 'Player'

func _ready():
	inputField.connect("text_submitted", text_submitted)
	change_group(0)

func _input(event):
	if event is InputEventKey:
		if event.pressed and event.scancode == KEY_ENTER:
			inputField.grab_focus()
		if event.pressed and event.scancode == KEY_ESCAPE:
			inputField.release_focus()
		if event.pressed and event.scancode == KEY_TAB:
			change_group(1)

func change_group(value):
	group_index += value
	if group_index > (groups.size() - 1):
		group_index = 0
		inputLabel.text = '[' + groups[group_index]['name'] + ']'
		inputLabel.set("custom_colors/font_color", Color(groups[group_index]['color']))

func add_message(username, text, group = 0, color = ''):
	chatLog.bbcode_text += '\n' 
	if color == '':
		chatLog.bbcode_text += '[color=' + groups[group]['color'] + ']'
	else:
		chatLog.bbcode_text += '[color=' + color + ']'
	if username != '':
		chatLog.bbcode_text += '[' + username + ']: '
		chatLog.bbcode_text += text
		chatLog.bbcode_text += '[/color]'

func text_submitted(text):
	if text =='/h':
		add_message('', 'There is no help message yet!', 0, '#ff5757')
		inputField.text = ''		
	if text != '':
		add_message(user_name, text, group_index)
		print(text)
		inputField.text = ''

This is what happened, but it still lags. Am I missing something?