Hello!
I'm attempting to rebirth an old custom chat project! I've come quite far and am now just implementing a few extra bells & whistles.
I'm having an issue with the latest addition, though. I am trying to integrate the default chat's feature of appropriately resizing the TextLabel on the Y-Axis to accommodate for text-overflow.
I thought for a minute and came up with the necessary steps required to achieve my goal, except I'm now having issues with properly executing my theory. I know that I must determine when the text exceeds the TextBox's AbsoluteSize on the X-Axis, and can recognize this with TextService's :GetTextSize() function, yet, it's not working the way I intended:/
What am I doing wrong?
local Player = game:GetService("Players").LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
local Chat = PlayerGui:WaitForChild("Chat")
local ChatFrame = Chat:WaitForChild("ChatFrame")
local ChatBar = ChatFrame:WaitForChild("ChatBar")
local TextService = game:GetService("TextService")
ChatBar:GetPropertyChangedSignal("Text"):Connect(function()
local TextTo = TextService:GetTextSize(ChatBar.Text, 8, "Code",
Vector2.new(ChatBar.AbsoluteSize.X, ChatBar.AbsoluteSize.Y)
)
if (TextTo.X > ChatBar.AbsoluteSize.X) then
local CurrentSizeY = ChatBar.Size.Offset.Y
ChatBar:TweenSize(UDim2.new(1, -10,0, CurrentSizeY + 15), "Out", "Sine", 1)
end
end)
Thanks!

4 comments
I'm slightly confused, maybe it's just the Script doing something weird
I'll try to rewrite it.
If you go the route of putting line breaks, it might be useful that a character takes five pixels in the font/size you used, so if your width is 100, you'd need to insert "\n" after every 20 characters
Thanks for the help again @clc02!