GetTextSize returning same Y size value

Another one of those annoying problems.

As i was making a pager system, it went all well. I made another frame inside a chat frame (for the player text to appear on the right side) and other peoples text to appear on the left side. Basically, I wanted it to look like a snapchat chat layout or any chat in that case.

Like this:
example
(from google not mine)

So, I wanted my textlabels to scale according to the text size, so II used the TextService:GetTextSize() function with appropriate parameters. However, it returns the same Y value for every sizes of texts.
I tried changing font size, font, textwrapped value, nothing!

Also if it may be useful, I’m cloning one Gui (if its the localplayer chatting) , I clone one frame inside the chat and if its another player chatting (other than the localplayer), it clones a textlabel inside the chat. This is to avoid recreating multiple instances every time a chat takes place.

Note:

  1. TextWrapped is turned off
  2. My AbsoluteSize is returning zero values every single time
  3. It’s absolutely annoying as no errors occur

I’ve searched all over the forum and nobody provided solutions other than “I figured it out”, “No more help needed”. Any suggestion will be deeply appreciated. Willing to enter team create for this, I’ve been stuck in this for like half a day and I’m almost giving up on this.

1 Like

Try setting the frameSize of GetTextSize.

2 Likes

I basically did
like

local Size = TextSvc:GetTextSize(TextVariable, 22, Enum.Font.Cartoon, Vector2.new(Frame.AbsoluteSIze.X, 1000)
print(Size)

Ive tried this so much that I basically memorized the arguments(parameters)

What value is Frame.AbsoluteSize.X?

Nothing wrong on my side:


image

1 Like

Ok, so I got it working. supposedly I was changing the size of the textlabel in a different script from the one I cloned it. I put the script in the same script that I cloned the GUI and it works now.

Well, I don’t get that logic at all :laughing:, but I’m glad it works and that you tried to help me.

Basically, the last argument sets the limit of the size of the textlabel that the text is allocated. So, setting the Frame.AbsoluteSize.X means that the text occupies all the X size of the textlabel, but since the Y is such a a big number, it can be bigger than the Y size value of the textlabel, which is why you can adjust the Y size.

1 Like