How to split a string into individual strings for each character

I’m currently trying to split strings into individual characters (this is so that i can create individual textlabels and color shift them to create a gradient effect). However, it doesn’t seem possible to split a string into individual strings for each character - how would this be accomplished?

If I interpret your question correctly - is string.split(str, "") what you’re looking for?

2 Likes

Thanks, worked well for me. Don’t know how I didn’t think of this

local String = "Hello world!"
for Character in string.gmatch(String, ".") do
	print(Character)
end

There’s also the string.gmatch() approach if you’re looking to iterate over each character.

1 Like

Interesting stuff, and thanks for the insight. @Blockzez’s solution worked, but I’ll try this as well.