Textbox AutomaticSize not expanding

I am trying to have a ScrollingFrame with a TextBox that grows indefinitely as more text is added.

I have ScrollingFrame.AutomaticCanvasSize.Y enabled and TextBox.AutomaticSize.Y enabled.

The problem is that AutomaticSize on the Textbox will not grow bigger than the parent frame (ScrollingFrame), which means that the AutomaticCanvasSize on the ScrollingFrame will not make the canvas bigger.

Is there something I am missing? How can I achieve a TextBox that expands indefinitely?

1 Like

Sounds strange but works: Add a UIListLayout to the ScrollingFrame, and remember to make sure that TextWrapped is enabled for the textbox.

1 Like

I can’t seem to get it to work. Could you provide a place file if you don’t mind?

1 Like

Is TextScaled set to true? If it isn’t and it still doesn’t work, then you’ll have to provide me with further details of what the textbox does now after the changes.

  • TextScaled = false
  • TextWrapped = true
  • ScrollingFrame.AutomaticCanvasSize = Enum.AutomaticSize.Y
  • TextBox.AutomaticSize = Enum.AutomaticSize.Y
  • UIListLayout.Parent = ScrollingFrame

If you got it to work, could you please provide the place file. It would be helpful.

:sweat_smile: Finally, just got it to work. I had to use a LocalScript to work around AutomaticSize since it seemed to stop working after a while. Sorry, it took some time for me to figure it out. Anyway, here’s the file for you to check out:

AutoScaleTextbox.rbxl (60.6 KB)

1 Like

Thank you!

This is good. I modified it slightly so that instead of using task.wait() in the while loop it does it instantly, that way there is no delay.

local TextBox = script.Parent
local InceaseYSize = 30 -- Change to the size of your font + 5.


game:GetService("RunService").RenderStepped:Connect(function()
	if TextBox.TextFits == false then
		TextBox.Size = UDim2.new(TextBox.Size.X.Scale, TextBox.Size.X.Offset, TextBox.Size.Y.Scale, TextBox.Size.Y.Offset + InceaseYSize)
	end
end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.