Currently, I’ve been scripting this header display and my client wanted it to rescale based on the text length, I’ve done something very similar to this for a chat system but I remembered never really finishing it because I didn’t understand it, but after doing my research, I managed to get it working … somewhat, the issue I’m having is the x-axis of the TextLabel is not being rescaled properly, in fact it looks like it’s even adding a few more pixels I’d say about 10-20, now I asked myself why could this be, and I believe it has a lot to do with how I’m using v2/frameSize, I set this parameter to the TextLabel's absolutesize, the problem I had with it, it tended to decrease in size and it kept being wrapped thus having a vital amount of space for the width portion, currently this is the code I am working with.
local function UpdateSize(Message)
local ViewportSize = workspace.Camera.ViewportSize
local TextSize = game.TextService:GetTextSize(Message, 28, Enum.Font.GothamBold, Vector2.new(ViewportSize.X, Label.AbsoluteSize.Y))
local Scale = OffsetToScale({TextSize.X , TextSize.Y})
Label.Size = UDim2.new(
Scale[1],
0,
Label.Size.Y.Scale,
0
)
end
Results I am getting:
![]()
![]()
Hopefully I was very detailed on the issue, one last thing, I know the use of Viewportsize.X Is there but again, It was the closest (working) thing to what I was trying to achieve!