I do not know what the code do you have, but you can check length of the text and move a line.
local text = "hello, im text"
if string.length(text) > 5 then
local leftPartOfText = string.sub(text, 0, 5)
local rightPartOfText = string.sub(text, 5)
text = leftPartOfText .. "\n" .. rightPartOfText
end