This is supposed to put another GUI at the correct position, but this keeps on messing me up:
local name = "text" userLabel = C:WaitForChild("user") userLabel.Text = name local q = 20 + userLabel.TextBounds.X -- q returns at 20 when it should go to the text size + 20.
I've also tried to find out this issue in different ways.
local name = "text" userLabel = C:WaitForChild("user") userLabel.Text = name while true do if userLabel.TextBounds.X ~= 0 then break; end print("Waiting for TextBounds..") wait(); end local q = 20 + userLabel.TextBounds.X
But the number stays at 0 and it won't change. Help is much appreciated. - Fighter169mobile
I had a similar issue where it did not update the TextBounds due to it not being on the players screen.
A new service has been added TextService which you can calculate the text bounds with the function GetTextSize.
Example:-
local textServ = GetService('TextService') local userLabel = C:WaitForChild("user") userLabel.Text = "text" local textBounds = textServ :GetTextSize( userLabel.Text, userLabel.TextSize, userLabel.Font, userLabel.AbsoluteSize ) local q = 20 + textBounds.X
I hope this helps.