How can i make an expanding search bar

image
I want to make the frame expand the more it types until the border hits a customizable limit
(hierarchy if u want it)
image

Theres a property that says the width of the text inside you can use that I think, I dont know for sure if it updates while typing though.

cant seem to find it, you sure its there? or maybe its under another name?

its called TextBounds
123123123123

currently, im doing

local fr = script.Parent
local input = fr.input

input:GetPropertyChangedSignal("Text"):Connect(function()
	if input.Text ~= "" and input.TextBounds.X > input.Size.X.Offset then
		fr.Size.X.Offset = input.TextBounds.X
	end
end)

Is this right? I’m getting an error “Offset can’t be assigned to.” Is this because textbounds is read only?

No, you have to assign .Size itself, not .Size.X.Offset.

Code:

local fr = script.Parent
local input = fr.input

input:GetPropertyChangedSignal("Text"):Connect(function()
	if input.Text ~= "" and input.TextBounds.X > input.Size.X.Offset then
		fr.Size = UDim2.fromOffset(input.TextBounds.X, 0)
	end
end)

it scales to the other side, how can i fix this?