TextLabel shifting right or left when a letter is added or removed

Hi, i opened this thread because i had a problem since a longggg time with roblox textlabels.

Look, when the “_” gets added, the text shifts to the right and when it gets removed it shifts to the left.

i tried everything, looking on devforums and asking AI but i can’t fix this issue so please someone help me here. (calculating the text bounds on advance but textbounds are read only, setting a UiTextConstraint but it dosen’t work the only time it worked it was when i put TextXAlignement to Left and removed textscaled but it makes two problems : scaling on all devices and centering the text in the textlabel)

Note : i want to keep my text scaled on all devices because just putting a textsize to the textlabel

From what I see, it’s legit just the X alignment. Because it’s supposed to be centered, it shifts because “_” is still part of the string, so it becomes equal on both sides. You could just make a new label and use math and code to align it to the end, or make it align to the left.

1 Like

i don’t understand what do you mean ???

The engine treats “Welcome…_” as a full string, so it does not ignore “_” when trying to center the text. That’s just not something it was made to do. If you DO want to ignore it, you can use math to add a new label to the end of the text, otherwise change TextXAlignment to Left.

Edit: escaped _ symbols

1 Like

image
?
Oh well that becouse you use TextScaled aka complete misunderstanding on how UI works;
Either make custom UI text scaler or just put another text label nearby where you will add/remove said symbol.
Also if not a secret, why UI is not in center?It looks odd.
Person above mentioned something similar as i understood.