Indentifier isnt declared in current scope error

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

Hi, I was making an 3D FPS Controller this afternoon an an error showed up saying “The identifier “Head” isnt declared in the current scope”, I have a KinematicBody with a CollisionShape set to a capsule, as well as a MeshInstance set to a capsule too and a Spatial named “Head” with a camera inside it. I’m just a beginner and i’ve scowered the internet on how to fix it, but it’s nowhere to be found. I would really appreciate if someone helped me out here. Thanks a bunch!

extends KinematicBody

var speed = 7
var acceleration = 20
var gravity = 9.8
var jump = 5

var mouse_sensetivity = 0.05

var direction = Vector3()
var velocity = Vector3()
var fall = Vector3()

func _ready():
    Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)

func _input(event):
	if event is InputEventMouseMotion:
		rotate_y(deg2rad(-event.relative.x * mouse_sensetivity))
		Head.rotate_x(deg2rad(-event.relative.y * mouse_sensetivity))
:bust_in_silhouette: Reply From: Inces

You meant :

$Head

or introduce like other variables

var Head = get_node("Head")