How do I make diferent Messages appear when interacting with diferent objects?

Godot Version

4.4

Question

How do I make diferent msgs appear whern interacting with diferent objects?

I have this script for interactable objects but I want to make diferent interactable objects that show diferent msgs and not always the same so I duped the script but now when I try to change the script it says I have “clasas_name Interactable” duped. How do I fix this? Im pretty new to coding sorry

extends CollisionObject3D
class_name Interactable

signal interacted(body)

@export var prompt_message = "Interact"

func interact(body):
	interacted.emit(body)
		

func _on_interacted(body):
	$AudioStreamPlayer3D.play()
	$"../Control/Label".visible = true
	await get_tree().create_timer(1).timeout
	$"../Control/Label".visible = false

Create a Dictionary of items and messages. When you need to display a random message, pull from the Dictionary and display.

Code below is very rough but should give you an idea. You can use a string, int, whatever for the dictionary key… depends on how you are tracking objects.

var item_messages: Dictionary[item, Array]

item_messages["chair"] = ["Message 1", "Message 2", "Message 3"]

func get_message(item):
    var msg: String = item_messages[item].pick_random()