How can I get the absolute text size of a text label?

Currently working on a pretty epic system, the only problem I have right now is getting the size of the text of a text label.

I could just use TextSize, but when a TextLabel uses TextScaled that simply wont work.
I’ve tried using TextBounds, but I am unsure as to how I could actually use it lol.

So what can I do to well do this? Thanks!

1 Like

By accessing TextLabel.AbsoluteSize…? What is this for?

this property is the AbsoluteSize of the TextLabel, not its text, am I supposed to use this with another value?

Just use TextBounds.

You’ll need to use TextService:GetTextSize

How I’ve used it is that I use TextBounds.Y which most of the time gives you the text size, but when the text goes onto another line it doesnt give the size, cause well thats not how that works.

So am I using it wrong?

Ill try it out rq

What are you attempting to do? I feel like this is an XY problem, and therefore we lack the information to best help you

I am working on a system to make TextLabels have TextShadow, by just making a textlabel that contains most of the properties the original TextLabel has.

Cloning the text wont work, and sometimes the text has a UITextSizeConstraint, of which things also get silly goofy.

This gives the exact same result of TextBounds, except the Y value it returns always gives me the FontSize I provided. I may be doing something wrong? But Im unsure.

You most likely restricted the function to the current boundaries of the TextLabel. The fourth argument often confuses people that way—myself included. Input a Vector2 whose vertical axis is unlimited (math.huge). GetTextSize will tell you how to reformat the boundary to accomodate for the text on the vertical axis

1 Like

Is it possible you could show me a code example?
I made this:

print(game:GetService('TextService'):GetTextSize('LABEL LABEL LABEL LABEL LABEL',14,Enum.Font.SourceSans,Vector2.new(math.huge,math.huge)))

It always gives me (168, 14), which the 14 part isnt an accurate size so Im not sure if I gotta do some math or something, but yeah thats what I’ve got!

Thanks for all your help btw!

Hello! Not sure if you can help with this, but just thought I’d ask just in case if you knew what I can do