I have a multiline text box that players can type in. When they press a button it is sent to the main chat functioning as an in-game copy and paste.
However, the text that is sent stays multiline. Instead I want it to be converted to single line because currently only the first line can be read.
Edit: The text from the TextBox is sent to a TextLabel. I still want the TextBox to be multi-lined.
sp.MouseButton1Click:connect(function() if messageBox.Text ~= '' and string.len(messageBox.Text) ~= 0 then event:FireServer(messageBox.Text) -- I want the textbox to remain multiline but change the variable sent to a single line string end end)
I figured it out but for anyone that may come across this problem.
string.gsub(msg, "\n", "")
White space/ MultiLine is represented by \n. If you replace all of those with nothing, the whitespace will be removed.
Uses: When pasting in a custom chat system, removes all the white space that may cause the text to be unreadable.