Help needed with starting animation

Godot Version

4.3

Question

In my latest game I’m making, you’re in a ship blasting enemies, and when you hit them, they flash red. However, the other enemy flashes red too, even though I didn’t hit him. So I’m at a loss as to make it so that only the enemy that gets hit plays the animation.

Here is the enemy code:

	if hit:
		HP -= 10
		animation_player.play("Hit")
		hit = false

Here is the bullet:

	if body.is_in_group("enemy"):
		if not body.invicible:
			body.hit = true
			queue_free()

Here’s how the enemy spawner spawns the enemy:

	var instance = enemy.instantiate()
	add_child.call_deferred(instance)

The enemies may be sharing a resource. If you are modifying a StandardMaterial3D to flash red then make sure it is to “Local to Scene”

Thanks a lot! It worked!