If further line breaks would cause the vertical height of the text (the Y component of TextLabel.TextBounds ) to exceed the vertical height of the element (the Y component of GuiBase2d.AbsoluteSize ), then that line will not be rendered at all.
So how can I fix this?
I want the TextBox to expand indefinitely vertically, without having to turn on TextScaling and then get super small text.
But TextWrapped seems to prevent me from doing so.
I think Roblox should change its behaviour of not rendering the other lines of the textbox if it goes over Y AbsoluteSize or whatever, while MultiLine is on.
I want to do a proper scrollable text box basically.
Hi @HealthyKarl , we’ve recently rolled out a change, please verify on your side if this update fixes the issue you mentioned above (this may require a software update on your RobloxStudio) and let us know, thank you!
Hi @HealthyKarl , could you please provide a place file so that we can verify on our end? I’ll investigate to see if it’s because the update is not published yet or the issue is not fixed.
There’s going to be a preferred textsize beta feature apparently
I wonder how it will work with automatic sizing and other things
Oh I just realized I created this post… Uhhh this was long ago I’d have to find the file again, so I can turn it in a proper Bug Report, since the way Bug Reports work were improved in the past.
I don’t really know if it actually is a bug or just our fault. I’d have to actually test this more but there was some sort of point that this issue had.
no its a bug with scaling, there are multiple and it does still happen
a work around i can think of is making the text box invisible (background and text) and just making it so a normal visible text label behind it updates with its text every time the text of the text box is changed, text labels should scale and wrap nicely
also what im noticing is that when you are not editing the text box it shows multiple lines normally but once you start editing everything gets squished into one line (im not sure if that changed or was always like that) - but what this means for the workaround is that if you leave the text box to auto-scale and wrap also, it will scale correctly when not editing and so you will be able to click on it everywhere where the text should expand
okay i am sorry i bumped this a bunch but i finally found a solution, the reason robloxes wrapping doesnt work is that when automatic size Y is set, it doesnt realize that it has infinite downwards space for text, it treats it as 0 and the wrap property then intentionally doesnt do anything
the best way i found to fix this is to not use automaticc size Y in combination with wrapped text boxes and instead if you need auto Y scaled wrapped text boxes code the automatic scaling yourself like so:
function BetterTextBox(box : TextBox)
box.TextWrapped = true
local padding_offset = Vector2.zero
local padding = box:FindFirstChildOfClass("UIPadding")
if padding then
padding_offset += Vector2.new(padding.PaddingLeft.Offset + padding.PaddingRight.Offset, padding.PaddingTop.Offset + padding.PaddingBottom.Offset)
end
local last_bounds = 0
local function update()
box.RichText = not box:IsFocused() -- remove line if you dont want rich text to work
local new_bounds = TextS:GetTextSize(box.ContentText, box.TextSize, box.Font, Vector2.new(box.AbsoluteSize.X - padding_offset.X, 99999999))
if new_bounds == last_bounds then return end
last_bounds = new_bounds
box.Size = UDim2.new(box.Size.X, UDim.new(0, new_bounds.Y+padding_offset.Y))
end
box.Focused:Connect(update)
box.FocusLost:Connect(update)
box:GetPropertyChangedSignal("TextBounds"):Connect(update)
box:GetPropertyChangedSignal("ContentText"):Connect(update)
end
that function also takes into account any UIPadding instance you have under the TextBox because thats what im doing, it also works with rich text (when you click away) but you can disable that if you want
OH and i alsmost forgot, i used the “legacy” TextService:GetTextSize function instead of the new TextService:GetTextBoundsAsync function because i wanted to avoid the Async part where it has to fetch a font config file from the roblox servers and whatnot. So basically its more reliable but only works for fonts in the old Enum.Font