Still have questions? Join our Discord server and get real time help.
Log in to vote

[SOLVED] Is it possible to apply TextService into Conditional Statements?

Asked by
Feahren 1581 Moderation Voter
4 months ago
Edited 4 months ago

I'm currently returning to an attempted project of mine that was to be a Custom Chat. It is extremely old with multiple deprecated methods and logic issues. I believe I've solved kost and am now working on improving reluctance in my lines. I cam across TextService and thought that It would help me out with calculation algorithms. I'm trying to use TextService:GetTextSize() to determine if the String of ChatLabel has exceeded the ChatLabels AbsoluteSize.X. This will, if true, set a new UDim2 Size to act as if the ChatLabel dropped a line. The formula I've implemented into the Peramiters is

local AbsoluteVectors =, ChatLabel.AbsoluteSize.Y)
local StringSize = TextService:GetTextSize(ChattedMessage, 5, "ArialBold", AbsoluteVectors)
--// I'm very confused wih this and haven't texsted it yet, but this is my Conditional Statement.
if (StringSize.X > ChatLabel.AbsoluteSize.X) then
   ChatLabel.Size = ChatLabel.Size -,0,0,-(-25))
   ChatLabel.TextWrapped = true

If this cannot be used like so, please let me know, but if there's other uses for it, or functional methods that'll strengthen this Statement, fill me in.


iirc GetTextSize returns a Vector2 so line 4 would fail, and why are you doing -(-25) that is the same as 25. incapaxx 3084 — 4mo
It was originally a piece in an algorithm, it was to convert x into a positive, how could I fix this TextService issue? Feahren 1581 — 4mo
maybe you meant StringSize.X? GoldAngelInDisguise 238 — 4mo
Yep, get the X from the resulting Vector2. Rheines 587 — 4mo
Thanks so much! Feahren 1581 — 4mo

Answer this question