Is there a way to add a new line after there are enough words on a textlabel?

Hello! lately i’ve been focusing on a subtitle system, similar to valve’s.

44cd6f4780a6301484fb50f98adf4a52

though, however; a issue im having with it is that if the text is very long, it just keeps getting smaller.

bd23da816b30392cff09679f2b9a98a0

now, i have tried using automaticsize, but that kept messing with the Y size A LOT. i could not get it to work how i wanted. and yes, textwrapped is on.

i just want to make it so while staying on the same size for everyone, i just need it to add a new line the moment it has enough words, i worded that badly i know. but hopefully you get the idea

for needed info, here is the structure first of all.
image

  • container holds everything, background is the black background, holder is where textlabels are put into, templates hold character specific textlabels

im not sure if the module info will be needed, it does not have anything related to sizing other than this, which sizes the background

help is appreciated. this has been bugging me for a long while now.

5 Likes

make the scale of the textlabel’s Y equal to math.ceil(string.len(<text>) / <amount of characters before newline>) then if needed add a newline where its needed

1 Like

Yes! There is. Set the AutomaticSize property of the label and it’s parent to “Y”.

excuse me for my dumbness, would the right way of using it be like this?
image

as i mentioned in the post, it messes with the sizing real bad, plus i cant size it down, it keeps getting stuck at this size (i manually tried lowering the y size to 0.1 on both yet it stayed at the same size)

(oh also it doesnt even scale in Y it just keeps sizing the text down)

no, capt.Size = UDim2.fromScale(capt.Size.X.Scale, capt.Size.Y.Scale * math.ceil(string.len(text) / 10))
assuming you are ONLY using scale

1 Like

oops
it seems to be sizing it a lot every 3 words, im not sure if its a error on my end but im sorry if it is
(i have the word amount on 10 as you sent there, im using the example you sent basically)

(I AM USING SCALE ONLY BTW YES)

you should raise the number to however many words you want before a newline is made

1 Like

but thatd still keep the issue, i have it at 10 rn, yet it starts sizing it for some reason on the 4th word, not the 10th

sorry, the thing is how many characters it is before a newline, not words

1 Like