How would I get the first letter of a string?

Please let me know and also the process (explanation)

2 Likes

You can use string.sub() to get letters of a string

local String = 'AmongUs'

print(string.sub(String, 1, 1))
-- 'A'
2 Likes

I asked for an explanation, what are both the 1’s

So the 1’s are used to get the characters in that range, so

string.sub(String, 1, 1)

get’s everything between 1 and 1 (the first character), doing

string.sub(String, 1, 3)

would get everything between 1 and 3 (‘Amo’)

6 Likes