-
What do you want to achieve? I am trying to make my own version of TextScaled by looping through all the text sizes from 100 - 1 and finding the highest one that fits inside of the text box.
-
What is the issue? TextBounds isn’t returning correct values
-
What solutions have you tried so far? I looked on the Dev Hub/Dev Forum but got nothing.
Here is the LocalScript
:
object.TextSize = 1
currentSize = 101
TextBoxSize = object.AbsoluteSize
repeat
currentSize = currentSize - 1
object.TextSize = currentSize
wait(.1)
TextSize = object.TextBounds
print(TextBoxSize, TextSize, object.TextSize)
if TextBoxSize.X < TextSize.X and TextBoxSize.Y < TextSize.Y then
TextSizes[#TextSizes + 1] = currentSize
currentSize = "DONE"
print("!!!FINISHED")
end
if currentSize ~= "DONE" then
if currentSize < 1 then
warn("A FATAL ERROR OCCURED! " .. tostring(currentSize))
return
end
end
until currentSize == "DONE"
At one of the lines, I put this:
TextSize = object.TextBounds
print(TextBoxSize, TextSize)
For some reason, TextSize
(the variable that holds the TextBounds) never changes, even though I change the size of the text.
BTW, object
is a TextLabel
.