2d Grapple Hook HELP "unexpected identifier"

Godot Version

` 4.3

Question

` I’m not sure what Ive done wrong to get this error in line 1 & 3, this is my first time coding so any help is appreciated!

extends CharacterBody2D

onready var grapple_ray = $GrappleRay
onready var grapple_line = $GrappleLine

var is_grappling: bool = false
var grapple_target: Node = null

const SPEED: float = 300.0
const JUMP_VELOCITY: float = -400.0

func _process(delta: float) → void:
grapple_ray.look_at(get_global_mouse_position())

if Input.is_action_just_pressed("grapple") and grapple_ray.is_colliding():
    start_grapple()

if is_grappling:
    update_grapple()

func _physics_process(delta: float) → void:
if not is_on_floor():
velocity += get_gravity() * delta

if Input.is_action_just_pressed("ui_accept") and is_on_floor():
    velocity.y = JUMP_VELOCITY

var direction: float = Input.get_axis("ui_left", "ui_right")
if direction != 0:
    velocity.x = direction * SPEED
else:
    velocity.x = move_toward(velocity.x, 0, SPEED)

move_and_slide()

func start_grapple() → void:
is_grappling = true
grapple_target = grapple_ray.get_collider()

grapple_line.points = [global_position, grapple_ray.get_collision_point()]
grapple_line.visible = true

func update_grapple() → void:
grapple_line.points[0] = global_position
grapple_line.points[1] = grapple_ray.get_collision_point()

var direction = (grapple_ray.get_collision_point() - global_position).normalized()
velocity = direction * 300  # Adjust pulling speed as needed

move_and_slide(velocity)

if Input.is_action_just_released("grapple"):
    end_grapple()

func end_grapple() → void:
is_grappling = false
grapple_line.visible = false
grapple_target = null
grapple_line.points = # Clear the line points
`

“onready” doesn’t work anymore, as you must use “@onready” instead.

If you hold ctrl/command while dragging from the scene tree to the code editor, the engine will put in the necessary code to set up an @onready variable.