How do I pick a random death message

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Evilcobra2213

I am trying to make multiple death messages and I want them to be chosen at random, how can I do that?

:bust_in_silhouette: Reply From: jgodfrey

Something like this should get you started

func _ready():
	var death_messages = [
		"message 1",
		"message 2",
		"message 3"
	]
	
	randomize()
	var msg = death_messages[randi() % death_messages.size()]