Please help with this error i do not understand

Godot Version

4.2


extends CanvasLayer
@onready var current_weapon = $VBoxContainer/HBoxContainer/CurentWeapon
@onready var current_ammo = $VBoxContainer/HBoxContainer2/CurrentAmmo
@onready var weapon_stack = $VBoxContainer/HBoxContainer3/WeaponStack


func _on_fps_rig_update_ammo(Ammo):
	current_ammo.set_text(str(Ammo[0]+" / "+str(Ammo[1])))


func _on_fps_rig_update_weapon_stack(Weapon_Stack):
	weapon_stack.set_text("")
	for i in Weapon_Stack:
		weapon_stack.text += "\n"+i
func _on_fps_rig_weapon_changed(Weapon_Name):
	current_weapon.set_text(Weapon_Name)



Question

error that I cannot understand I checked it what is wrong with it?

I assume it’s just a type that you define current_weapon as @onready var current_weapon = $VBoxContainer/HBoxContainer/CurentWeapon and CurentWeapon there should be CurrentWeapon thus the node is not found, so it’s null, so there is no function set_text on the null object stored in current_weapon.
To mitigate this you can set it as @onready const your_var_name: Node = $path so you’ll get warned if it’s not a node, insead of when you try to use it.

your solution didn’t work so here is the whole code with a bit of changes in the variables for better readability.

Hud.gdscript


extends CanvasLayer
@onready var CurrentWeaponLabel = $VBoxContainer/HBoxContainer/CurentWeapon
@onready var CurrentAmmoLabel = $VBoxContainer/HBoxContainer2/CurrentAmmo
@onready var CurrentWeaponStack = $VBoxContainer/HBoxContainer3/WeaponStack
@onready var fps_rig = $camera/SubViewportContainer/SubViewport/GunCamera/fps_rig


func _on_fps_rig_update_ammo(Ammo):
	CurrentAmmoLabel.set_text(str(Ammo[0]+" / "+str(Ammo[1])))


func _on_fps_rig_update_weapon_stack(Weapon_Stack):
	CurrentWeaponStack.set_text("")
	for i in Weapon_Stack:
		CurrentWeaponStack.text += "\n"+i
func _on_fps_rig_weapon_changed(Weapon_Name):
	CurrentWeaponLabel .set_text(Weapon_Name)

Weapons_Manager.gdsript

extends Node3D
@onready var animation_player = $AnimationPlayer

signal Weapon_Changed
signal Update_Ammo
signal Update_Weapon_Stack
var Current_Weapon = null

var Weapon_Stack = []

var Weapon_Indicator = 0

var Next_Weapon: String

var Weapon_List = {}



@export var _weapon_resources: Array[Weapon_Resource]

@export var  Start_Weapons: Array[String]


func _ready():
	Initialize(Start_Weapons)
	
func _input(event):
	if event.is_action_pressed("weapon_up"):
		Weapon_Indicator = min(Weapon_Indicator+1, Weapon_Stack.size()-1)
		exit(Weapon_Stack[Weapon_Indicator])
		
	if event.is_action_pressed("weapon_down"):
		Weapon_Indicator = max(Weapon_Indicator-1,0)
		exit(Weapon_Stack[Weapon_Indicator])
		
		
		
	if event.is_action_pressed("reload"):
		animation_player.play(Current_Weapon.Reload_Anim)
		print("reloaded")
		
		
		
	if event.is_action_pressed("shoot"):
		animation_player.play(Current_Weapon.Shoot_Anim)
		print("shot")
		
	
		pass
	
	

func Initialize(_start_weapons: Array):
	for weapon in _weapon_resources:
		Weapon_List[weapon.Weapon_Name] = weapon
	for i in _start_weapons:
		Weapon_Stack.push_back(i)
		
	Current_Weapon = Weapon_List[Weapon_Stack[0]]
	emit_signal("Update_Weapon_Stack", Weapon_Stack)
	enter()

func enter():
	animation_player.queue(Current_Weapon.pullout_Anim)
	emit_signal("Weapon_Changed", Current_Weapon.Weapon_Name)
	emit_signal("Update_Ammo", [Current_Weapon.Current_Ammo, Current_Weapon.Reserve_Ammo])
	
	
func exit(_Next_Weapon: String):
	if _Next_Weapon != Current_Weapon.Weapon_Name:
		if animation_player.get_current_animation() != Current_Weapon.Pullitdown_Anim:
			animation_player.play(Current_Weapon.Pullitdown_Anim)
			Next_Weapon = _Next_Weapon
	
	
func Change_Weapon(weapon_name: String):
	Current_Weapon = Weapon_List[weapon_name]
	Next_Weapon = ""


	enter()
func _on_animation_player_animation_finished(anim_name):
	if anim_name == Current_Weapon.Pullitdown_Anim:
		Change_Weapon(Next_Weapon)
		
		
		
		
		
func shoot():
	pass
	
	
	
	
func reload():
	pass

Weapons_Resource.gdscript

extends Resource

class_name Weapon_Resource
@export var Weapon_Name: String
@export var Shoot_Anim: String
@export var pullout_Anim: String
@export var Pullitdown_Anim: String
@export var Reload_Anim: String
@export var Current_Ammo: int
@export var Reserve_Ammo: int
@export var Magazine: int
@export var Max_Ammo: int
@export var Auto_Fire: bool 

Error: Invalid Call. Nonexistant function ‘set_text’ in base ’ Nil’
ON LINE CurrentWeaponStack.set_text("")

Do you have a Node actually named CurentWeapon?

i have a label named currentweapon

“CurrentWeapon” is not the same as “CurentWeapon”
fix the typo in your code