Scary: Unexpected "Identifier" in class body

Hello! I recently started developing my game and in this code:


# Ссылка на TextureRect
onready var image = $Image  # Убедитесь, что путь к узлу правильный

# Функция, вызываемая при запуске сцены
func _ready():
    image.visible = false  # Скрыть изображение при запуске

# Функция, вызываемая при нажатии на TextureButton
func _on_ToggleButton_pressed():
    image.visible = !image.visible  # Переключить видимость изображения

# Функция для обработки ввода
func _input(event):
    if event.is_action_pressed("ui_cancel"):  # Проверяем нажатие кнопки Esc
        get_tree().change_scene_to_file("res://menu.tscn")  # Переход на сцену menu```
I got an error ChatGPT, no matter how hard I tried, couldn’t help, and unfortunately (probably due to my age) I don’t understand (and wouldn’t understand even if I wanted to). I would like to understand what the error is and at least find out a solution. All I could understand is that the problem is that the order was not observed correctly (probably I just tried to combine 2 scripts and this happened)I apologize for a lot of text, and my possible stupidity (I’m nobody in this topic)
P.S. I apologize again for possible dictionary errors, I’m translating from another language
Version: 4.3stable (For Steam)

This error means part of your script needs indentation. It could also be on ready? You mention ChatGPT which notoriously gets Godot 3.x version scripts mixed in. Make sure it’s @onready var image

Make sure to format your script pastes or the indentation is removed from the forum post.