Full iteration

It’s quite simple to iterate through the text. Just make sure you respect sorting.

Simple method

It’s clean and easy to use the GetCharacters function, which will iterate through all characters. This function is optimized and respects all sorting.

You can simply iterate through the characters like this:

for characterNumber, character in Text.GetCharacters(frame) do
	-- For Roblox fonts, 'character' will be a TextLabel.
	-- For custom fonts, 'character' will be an ImageLabel.
end

Advanced method

You can also manually loop through. This is useful for more controlled iteration.

Here’s an example with full sorting on:

for lineNumber, line in frame:GetChildren() do
	-- 'line' will be a folder.
	for wordNumber, word in line:GetChildren() do
		-- 'word' will be a folder.
		for characterNumber, character in word:GetChildren() do
			-- For Roblox fonts, 'character' will be a TextLabel.
			-- For custom fonts, 'character' will be an ImageLabel.
		end
	end
end

If you have only one of the sorting types enabled, there will only be one layer of folders, and you’ll have to do something like this:

Last updated