Help please trying randomize strings with this

Try a short one off timer between the two lines

func _on_area_entered(area: Area2D) -> void:
    if area.is_in_group("npc"):
        $reaction.text = lines.pick_random()
        await get_tree().create_timer(0.75)
        self.queue_free()

did not work

is $reaction hidden by default? do you need to show it after selecting a line? Maybe you could paste your entire script and again state what exactly is happening vs what you expect to happen.

extends Area2D

const SPEED: float = 500
const SCREEN_WIDTH_MAX = 1000
const SCREEN_WIDTH_MIN = 0
var lines = ["Help I got hit by a bomb",
"I think I got egg on my face wait no it's mayoniase",
"Help the sky is falling",
"What in the world why is glue falling from the sky",
"Watch out the goverment is testing bio weapons again",
"Oh great and I just got octopus ink out of my hair",
"Oh great just when I ate bird it rains bird scat"]



var moving_right = true

func _process(delta):
	if moving_right == true:
		position.x += SPEED * delta
		if position.x > SCREEN_WIDTH_MAX:
			moving_right = false
	elif moving_right == false:
		position.x -= SPEED * delta
		if position.x < SCREEN_WIDTH_MIN:
			moving_right = true



func _on_area_entered(area):
	if area.is_in_group("npc"):
		pick_random(lines)
		queue_free()
		get_tree().current_scene.respawn_npc()

```i want the npc to say these lines each time it's hit but in a random order

Is this script attached to “NPC”? and is NPC the only node in group “npc”? If so you are only detecting collisions between a NPC and another NPC, not an NPC and a projectile. I’m betting that’s your first issue, if you had a print statement it never triggers?

func _on_area_entered(area):
	if area.is_in_group("npc"):
		print("Got hit") # does this ever print?

Next you aren’t using pick_random correctly. the sample given is on lines.pick_random()

And you didn’t use a timer between setting the text and deleting it through queue_free().

i know i tried a different way that way does not work also no NPC is not the only node in the group the projectile hitting the npc is in the group to