Textbox property help (script)

SERVER.TextBox:GetPropertyChangedSignal("Text"):Connect(function()
    local lines = getNumberOfLines(SERVER.TextBox.Text)
    local str = ""

    for i=1, lines do
        str = str .. i .. "\n" 
    end    
    if SERVER.TextBox.Text == "" then SERVER.TextLabel.Text = ">"
    else     
        SERVER.TextLabel.Text = "<b>" .. str .. " </b>"
    end    
end)

bug is when they type so much that it puts the text on the second line it doesnt number that line which the long text was brought to

its suppose to number it

hehehehe

1 Like

if you want to implement your own text wrapping, you could iterate each line (str) to count how many characters there are, and if there are say, >50, separate anything after the cutoff to the next line. Loop until there’s no longer >50 characters in a line.
Though from an IDE standpoint that’s a form over function decision that may confuse people, it’s normally up to the programmer to fix their line width.
You might also set the numbers’ Y-alignment to Center and scale the numbers’ TextLabel to that of the string’s label, so it stays the same height.

how would i make is so the textbox’s size increases on the X axis instead of going to the next line. is there a property for that in textbox?

You could disable the textbox’s TextWrapped property to force it onto a single line