I need GUI help

I have absolutely no idea how to approach this, so if anyone knows a way, please teach me instead of spoonfeeding.

I have TextBox and the black Frame which you can see here.
Screen Shot 2020-09-03 at 5.35.10 PM

When the TextBox’s text is edited, the frame adjusts its size to match the text’s horizontal size if that makes sense at all.

I know how to use GetPropertyChangedSignal, but have no idea how to calculate the correct size. Can anyone help me?

1 Like

You can use the Textboxs TextBounds property.

You would have to get the length of the string that the player has entered. using this you can work out roughly how big it will be.

To work out the max number of characters just fill up a text box and reposition it until it reaches a size limit you think would be acceptable. Then get the length of that string you put in. Also figure out the max size for your string.

Now that you have the max number of characters you will allow. You can do

local SFP = Frame.Position -- Starting position

local MaxSize = 10
local MaxLength = 50

local Factor = string.len(TextBox.Text) / MaxLength

Text.Size = MaxSize * Factor
Frame.Size = Frame.Size * Factor -- Not 100% sure this is the correct way but you get what im trying to do
Frame.Position = SFP / Factor

This is roughly how I would go about it. I wouldn’t copy and paste this tho, most likely will have a bunch of small stuff to change.