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 577 Moderation Voter
6 days ago
Edited 6 days 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. incapaxian 1315 — 6d
It was originally a piece in an algorithm, it was to convert x into a positive, how could I fix this TextService issue? Feahren 577 — 6d
maybe you meant StringSize.X? GoldAngelInDisguise 176 — 6d
Yep, get the X from the resulting Vector2. Rheines 400 — 6d
Thanks so much! Feahren 577 — 6d

Answer this question