Invalid get Index 'position' (on Base: 'Nil')

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Iluminati069

extends Area2D
var speed = 3
var move = Vector2(0,0)
var look_vec = Vector2(0,0)
var player = null

func _ready():
look_vec = player.position - global_position

func _physics_process(delta):
move = Vector2(0,0)

move = move.move_toward(look_vec, delta)
move = move.normalized() * speed
position += move
:bust_in_silhouette: Reply From: kidscancode

You have player = null on line 5, so player.position fails with the error message in the title.