TextLabel Text Size Position

i have been struggling for a little bit of trying to figure this out.

how would you get the very left side of a TextLabels text and position another GuiObject to that spot?

this is the furthest i have gotten with this:

local Textsize = Name.TextBounds
	Textsize = Name.Position - UDim2.fromOffset(Textsize.X/2,0)
	local stop = Textsize
	ActiveDot.Position = stop 
1 Like

Try using AbsoluteSize and AbsolutePosition instead, it gets the size and position respectively of the GUI object by pixels.

local Textsize = Name.TextBounds
local goalPos = UDim2.fromOffset(Textsize.AbsolutePosition.X, Textsize.AbsolutePosition.Y) - UDim2.fromOffset(ActiveDot.AbsoluteSize.X,0)
-- get absolute pos of text and subtract by the size of the dot
ActiveDot.Position = goalPos 
1 Like

“AbsolutePosition is not a valid member of Vector2”

I just did some tinkering and found the solution:

	local Bounds = Name.TextBounds
	
	local Textsize = Name.Position
	
	local Position = Textsize
	local Size = UDim2.fromOffset(Bounds.X,Bounds.Y)
	ActiveDot.Position = Position - (UDim2.new(Size.X.Scale/2,Size.X.Offset/2,0,0))
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.