Automatically line break a long text label

I’m making a script that creates a TextLabel every time you insert text into it.
However, because of how TextLabels work on a SurfaceGui, if the text you inserted into it was too long, it would go off of the SurfaceGui (shown in the screenshot.)
image

Is there anyway I can automatically add line breaks to the text if it is too long?

1 Like

*Resolved.
Used GetTextSize to get an approximate size of the inserted text. (Variable: sizings)

Did sizings divided by AbsoluteSize X of the part (1546.4) (Variable: Xsize)

Did Xsize multiplied by the AbsoluteSize Y of all the other text labels (60.551) (Variable Finalsize)

Set new text label size to Vector2.new(1546.4, Finalsize)

Finally, did a loop to check which TextSize is the biggest and fits.

2 Likes