Why does my function say nonexistent function

Godot Version

4.2

Im trying to get my bullet to hurt zombies in my game but when i run the game it says nonexistent function
Body part for zombie code -

extends Area3D

@export var damage := 1
signal body_part_hit(dam)

func _ready():
	pass

func _process(delta):
	pass

func hit():
	emit_signal("body_part_hit", damage)

zombie code -

extends CharacterBody3D
const ATTACK_RANGE = 5
var player = null
var state_machine
var health = 6

const SPEED = 6.0
@onready var nav_agent = $NavigationAgent3D
@onready var anim_tree = $AnimationTree
@export var player_path := "/root/World/map/NavigationRegion3D/Player"

func _ready():
	player = get_node(player_path)
	state_machine = anim_tree.get("parameters/playback")
	
	
	
func _process(delta):
	velocity = Vector3.ZERO
	
	
	match state_machine.get_current_node():
		"Run":
			nav_agent.set_target_position(player.global_transform.origin)
			var next_nav_point = nav_agent.get_next_path_position()
			velocity = (next_nav_point - global_transform.origin).normalized() * SPEED
			look_at(Vector3(global_position.x + velocity.x, global_position.y + velocity.y, global_position.z + velocity.z), Vector3.UP)
		"Attack":
			rotation.y = lerp_angle(rotation.y, atan2(velocity.x,velocity.z),delta * 10.0)
	
	anim_tree.set("parameters/conditions/attack", _target_in_range())
	anim_tree.set("parameters/conditions/run", ! _target_in_range())
	
	anim_tree.get("parameters/playback")
	
	move_and_slide()

func _target_in_range():
	return global_position.distance_to(player.global_position) < ATTACK_RANGE


func _hit_finished():
	if global_position.distance_to(player.global_position) < ATTACK_RANGE + 1.0:
		var dir = global_position.direction_to(global_position)
		player.hit(dir)


func _on_area_3d_body_part_hit(dam):
	health -= dam
	if health <= 0:
		queue_free()

bullet code -

extends Node3D

const SPEED = 160
@onready var mesh = $MeshInstance3D
@onready var ray = $RayCast3D
@onready var particles = $GPUParticles3D


func _process(delta):
	position += transform.basis * Vector3(0,0, SPEED) * delta
	if ray.is_colliding():
		print("COLLIDING")
		mesh.visible = false
		particles.emitting = true
		ray.enabled = false
		if ray.get_collider().is_in_group("enemy"):
			ray.get_collider().hit()          (this line)
		await get_tree().create_timer(1.0).timeout
		queue_free()
func _on_timer_timeout():
	queue_free() # Replace with function body.

the line “ray.get_collider().hit()”
when i run the game it says “Invalid call. Nonexistent function “hit” in base Area3D”
the Area3d is a child of the skeleton which is the child of the zombie/characterbody3d
by the way the collision is a child of area3d. i don’t know if this is useful information since I’m a beginner sorry.

Can you post your code between three ticks? pressing the </> will create this for you.

```
type or paste code here
```

Please post the full error message and point out which line is triggering the error.

Try printing out the collider, make sure it actually is the zombie Area3D, since there is a zombie CharacterBody3D I could see it hitting the body instead of the area. Which is in group “enemy”? The CharacterBody3D or the Area3D?

i forgot to drag the script to all the area3d Nodes
but thank you for all the help