TextBounds signal does not fire upon parenting

I just got back from my 2 week honeymoon in Italy and a handful of the Gui’s in my game seem to behave strangely.

My chat input UI normally resizes depending on the label’s TextBounds:
image

Expected behavior:
image

The tooltips across my game were also broken:
image

Expected behavior:
image

Here’s a repro:

local label = Instance.new("TextLabel")
label.Text = "First test!"
label:GetPropertyChangedSignal("TextBounds"):Connect(function()
    print("TextBounds changed:", label.TextBounds)
end)

print("TextBounds before:", label.TextBounds)
label.Parent = script.Parent
print("TextBounds after parenting:", label.TextBounds)

wait(1)

print("Changing text...")
label.Text = "Second test!"

Here’s the output with the bug:

TextBounds before: 0, 0
TextBounds after parenting: 48, 12
Changing text...
TextBounds changed: 67, 12

The previous behavior would output this:

TextBounds before: 0, 0
TextBounds changed: 48, 12
TextBounds after parenting: 48, 12
Changing text...
TextBounds changed: 67, 12

I fixed most of these issues in my game, but this should still be fixed.

Try :GetTextSize(), I believe it’s a function of TextService but I’m not sure.

Yeah, this happened with the recent UI update

I hope you enjoyed your honeymoon :slightly_smiling_face:

2 Likes

I’ll work on fixing this soon. If you want, I can add your game to a blacklist for the new system until then.

1 Like

Thanks! but my problems weren’t too hard to fix by refreshing textbounds after parenting.