Error node not found, how do i fix this?

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

This is my problem down bellow

Here’s the code and the error

extends Node

export var fire_rate = 0.5
export var clip_size = 5
export var reload_rate = 1

var current_ammo = clip_size
var can_fire = true
var reloading = false

onready var raycast = $“…/Head/Camera/RayCast”

func _process(_delta):
if Input.is_action_just_pressed(“primary_fire”) and can_fire:
# fire the weapon
if current_ammo > 0 and not reloading:
can_fire = false
print(‘Fired Weapon’)
current_ammo -= 1
yield(get_tree().create_timer(fire_rate), “timeout”)
check_collision()
can_fire = true

	elif not reloading:
		print('reloading')
		reloading = true
		yield(get_tree().create_timer(reload_rate), "timeout")
		current_ammo = clip_size
		print('reload complete')
		reloading = false

func check_collision():
if raycast.is_colliding():
var collider = raycast.get_collider()
if collider.is_is_group(“Enemies”):
collider.free_queue()
print('Killed ’ + collider.name)

The error

node not found

This is the node path pasted

Player/Head/Camera/RayCast

So the basic thing that is happening is that it is not finding the node even though everything seems right to me and I have checked so many times that it is spelt right.

SO PLEASE HELP IT WOULD BE VERY APPRECIATED

Please share an image of your scene tree, along with what node you are running this script from.

DDoop | 2020-07-01 17:06

:bust_in_silhouette: Reply From: Jorge

your path in the code is

$“…/Head/Camera/RayCast”

and you said that the path copied is:

Player/Head/Camera/RayCast

aren’t you missing Player ?

try :

$“…/Player/Head/Camera/RayCast”

good luck

THANKS SOOO MUCH

That worked and I have just realised I’m really dumb because I spent 30 minutes trying to sort out another error which was a damn spelling mistake

LMAObrain.exe has been deleted

Yeh I had tried

$"/Player/Head/Camera/RayCast"

but it should have been with the two dots in front

$"../Player/Head/Camera/RayCast"

, By the way, what do the two dots mean.

BIDDIDYBOOPDEV | 2020-07-02 08:21

glad you found it!

you could use also

onready var raycast = preload (“res://Player/Head/Camera/RayCast”)

I think the … mean “res://” , it takes you to the root node

and $ = get_node in Godot 3.2

good luck!

Jorge | 2020-07-02 11:34