Is there a way to auto resize TextLabel based on Text Length or how many lines in the TextLabel? Thank you!
there is a way to make the text into the textlabel auto resize itself on the amount of letters. Is this what you mean?
Yes and also I want it to auto change the parent size too (which is a frame)
Hi,
You wouldn’t really want to change the parent frame. Instead you create an invisible “MaxFrame” that have the size in max width & height. Make sure the GUI you put this in, have ZIndexBehavior set to Global
Next up, you create two object, a TextLabel and a Frame.
- Textlabel should have the following properties & be parented to MaxFrame:
AnchorPoint = Vector2.new(0.5,0.5)
Size = UDIM2.new(0,0,1,0)
ZIndex = 2
-- For TextLabel Position, put a UIListLayout into the MaxFrame, and set it to whatever corner you want. Alternative would be just setting the Position manually in the TextLabel.
- Frame will act as “background” and should have the following properties & be parented to TextLabel:
AnchorPoint = Vector2.new(0.5,0.5)
Position = UDIM2.new(0.5,0,0.5,0)
ZIndex = 1
Size = UDIM2.new(1,5,1,5) -- The 5's acts as the gap between the background and the text, they're pixels. Change it to your liking.
-- You can also insert a UIStroke to the Frame, that you can make a bit darker to get a nice edge effect.
That should now work as intended.
Uhm, but I have a dark (black) background frame and want it to resize when my text label (grey background) size increases. So basically it has two colors, black for frame and grey for text label or text box, i want both increase.
Hi again, is there something you did not understand with my method? My method does exactly what you’re trying to achieve. MaxFrame, Frame & TextLabel is the 3 objects you need. Since Frame is parented to TextLabel, and TextLabel changes size, from 0 and up to Max width & max height of MaxFrame, it(Frame) will change size aswell.
Edit: I’ve added Size to TextLabel aswell
I used a little bit of time, to create the ui for you. Here is a sample you can look at
TextBoxSizeChanging.rbxl (37.3 KB)