How to get the _th letter from a value?

Hello.

Sorry if the title doesn’t make sense but I need help with figuring out how to get for example the fourth letter from a value.

Like the value of the variable is “hello” and I want to get the 5th letter from it (which is o), how I would I do this? Is it even a thing?

Thanks.

1 Like

You can use string.sub() to return substrings of strings.

Ex:
string.sub("Hello",4,4) returns “l”

https://developer.roblox.com/en-us/api-reference/lua-docs/string

3 Likes

Thanks for the help and the quick response :smiley: