How do I make something that selects one letter of text?

How do I make something that selects a random letter from some text like “HELLO” > “E”?

local myString = "HELLO"

local Rand = Random.new()
local Length = string.len(myString)
local LetterNum = Rand:NextInteger(1,Length)

local Letter = string.sub(myString,-(LetterNum-2),(LetterNum+1))
print(Letter)

If this answers your question, remember to mark it as an answer!

1 Like