As a Roblox developer, it is currently impossible to feed TextService:GetTextSize()'s fontSize parameter knowing the actual TextSize of a TextScaled true TextLabel/Box/Button.
TextObject.TextBounds is not a reliable tool for getting text bounds because you have to wait a frame. The only synchronous way is TextService:GetTextSize(). But this poses a big challenge to people who use scaled UI and is trying to find exact text bounds.
Text(Label/Box/Button):GetTextScaledApproximateSize() returns a decimal (number). If TextScaled is false, it will just return the TextSize. This will be good use for the fontSize parameter for the GetTextSize function to get accurate results.
Edit: Not many use cases for this and would lead to API bloat. Probably ignore.
Servers don’t have a screen or camera, so it makes sense that TextBounds (or any other property that depends on the size of the screen directly or indirectly, such as AbsoluteSize of AbsolutePosition) wouldn’t be useful when read from the server.
If, instead, the Size of the label used scale (e.g. UDim2.new(1, 0, 1, 0)) what would the AbsoluteSize (and, indirectly, the TextBounds) of the BillboardGui/Text be when you read it from the server?
EDIT2: I think it’s important to ask why you’re attempting to read the TextBounds on the server in the first place. Do you plan on modifying the client’s UI from the server?
I’m using custom name tags above character’s heads, and a background that sizes based on the text length. I feel its easier to do when the client sends custom user input through a Remote and have the server change their tag.
The tags (BillboardGuis) I do have in my game were cloned and parented to the heads of characters in workspace through a server script. The examples you put are those for ScreenGuis, which are player-local only. BillboardGuis only display in the workspace.
Therefore, are these BillboardGuis still client GUI?
If I’m understanding your usecase right, since you’re resizing a BillboardGui, and BillboardGuis may resize based on their distance from the camera, and you’re trying to resize them dynamically, I would say that these should be rendered client-side.
If I’m not, then I think you should demo how you intend to use GetTextScaledApproximateSize if it were implemented.
local Bounds = TextService:GetTextSize("Hello", Label:GetTextScaledApproximateSize(), Enum.Font.SourceSans, Label.AbsoluteSize)
print(Bounds) -- Varies based on the user's screen
Again, Label:GetTextScaledApproximateSize() just simply returns the actual TextSize of a TextScaled label/box.
Label:GetTextScaledApproximateSize() But what size will the label use if it uses the scale component, the server doesn’t have a camera nor a screen
If the gui is far from the camera, the text size will be small. If it’s close, it will be larger. Since the server doesn’t have a camera, how would it determine the size of the text in the first place?
Like how a BillboardGui’s scale is related to the part’s size which is adorned, the label to also have the scale component (with TextScaled) will be related to the BillboardGui.
Therefore, the camera has nothing to do with this.
EDIT2: The camera is needed for TextScaled. My bad.
local Bounds = TextService:GetTextSize("Hello", Label:GetTextScaledApproximateSize(), Enum.Font.SourceSans, Label.AbsoluteSize)
print(Bounds) -- Varies based on the user's screen