These 2 scripts are messing up the game help me [SOLVED]

Godot Version

4.2.2

QUESTION

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
WHiiuase fihaegrinrswhb

extends Node3D

@onready var primary = self.get_child(0)
@onready var secondary = self.get_child(1)

var currentWeapon : int = 0

var changeSpeed = 0.5
var canChange = true

var isChanging = false

@onready var animationPlayer = self.get_child(2)

func _process(_delta):
	
	if currentWeapon == 1:
		primary.set_visible(true)
		secondary.set_visible(false)
		
	if currentWeapon == 2:
		secondary.set_visible(true)
		primary.set_visible(false)
		
		

	if Input.is_action_just_pressed("key1") and canChange and currentWeapon != 1:
		currentWeapon = 1
		animationPlayer.play("ar_pullUp")
		animationPlayer.stop()

	if Input.is_action_just_pressed("key2") and canChange and currentWeapon != 2:
		currentWeapon = 2
		animationPlayer.play("pistol_pullUp")

extends Node3D

const adsSPD : float = 10
# We gotta do the shakey focus thingi


var defaultPosition : Vector3
var adsPosition : Vector3



@onready var primary = self.get_parent().get_child(0)
@onready var secondary = self.get_parent().get_child(1)


@export var wepFalloff : Curve

@onready var cast: RayCast3D = self.get_parent().get_child(3)

var gunInfo = [5]

var isAiming

func _process(delta):
	if Input.is_action_pressed("fire2") && WepManager.currentWeapon == 1:
		self.transform.origin = lerp(self.transform.origin, adsPosition, adsSPD * delta)
		isAiming = true
	else:
		self.transform.origin = lerp(self.transform.origin, defaultPosition, adsSPD * delta)
		isAiming = false
	if Input.is_action_pressed("fire2") && WepManager.currentWeapon == 2:
		secondary.transform.origin = lerp(secondary.transform.origin, secondary.adsPosition, secondary.adsSPD * delta)
		isAiming = true
	else:
		secondary.transform.origin = lerp(secondary.transform.origin, secondary.defaultPosition, secondary.adsSPD * delta)
		isAiming = false
	if WepManager.currentWeapon == 1:
		gunInfo[0] = primary.get_meta('RecoilPerShot')
		gunInfo[1] = primary.get_meta("RecoilPerShot_Position")
		gunInfo[2] = primary.get_meta("FireMode")
		gunInfo[3] = primary.get_meta("attachments")
		gunInfo[4] = primary.get_meta("Falloff")

func _physics_process(delta):
	
	
	
	if Input.is_action_pressed("fire1"):
		if cast.is_colliding():
			var collisionPoint = cast.get_collision_point()

			# we get weapon stuff from here

			var dist = (collisionPoint.get_distance(cast.position)) / 1000

			var damage = wepFalloff.sample(dist)

			var hitCollider = cast.get_collider()

			var hitObject = hitCollider.get_parent()
			if not hitObject == null:
				hitObject.take_damage(damage)
			var currentWeapon = WepManager.get_child(WepManager.currentWeapon)
			
			
			currentWeapon.position.lerp(currentWeapon.positon, currentWeapon.transform.position + gunInfo[0], gunInfo[5])
	
	
	
	
	

PLZ HE:P THESE ARE THE ERROR

E 0:00:04:0928 WepManager.gd:3 @ _ready(): Index p_index = 0 is out of bounds
E 0:00:04:0928 WepManager.gd:4 @ _ready(): Index p_index = 1 is out of bounds
E 0:00:04:0929 WepManager.gd:13 @ _ready(): Index p_index = 3 is out of bounds
E 0:00:04:0929 ADS.gd:18 @ _ready(): Index p_index = 3 is out of bounds

###WHY IS EBVERYTTHING OUT OF BOUNDS

Note how both scripts are in autoload

i fixed it myself, i removed the autoload of both scripts and instead replaced them with 1 global that doesnt create errors