This bug was experienced by many players on my PC exclusive game. The game’s chat GUI sizes messages by setting the Text of a message box and increasing its size until TextFits == true
.
However, this was always hitting my iteration failsafe and leaving the message box massive as TextFits was never being set to true, even on very small messages.
I’m not sure if this change was intentional, but this code was working until recently.
To reproduce:
- Place the following code in a LocalScript inside a PlayerGUI for a reproduction.
local textBoxHolder = Instance.new("Frame", script.Parent)
textBoxHolder.Visible = false
local textBox = Instance.new("TextBox", textBoxHolder)
textBox.Size = UDim2.new(0,10,0,20)
-- The text box's width is way too small to fit its contents
textBox.Text = "OnlyTwentyCharacters"
print(textBox.TextFits) -- false, as expected
-- This width should absolutely fit our text
textBox.Size = UDim2.new(0,400,0,20)
print(textBox.TextFits) -- false
-- But it doesn't...
-- Until we make the TextBox's parent visible
textBoxHolder.Visible = true
print(textBox.TextFits) -- true