When capturing the focus of a textbox after its focus was lost via pressing enter, a carriage return character (\r) is added to the text.
That is, if you have the following code inside of a TextBox has
ClearTextOnFocus set to false, focus it, and press enter, it’ll add a carriage return to the end of the text.
script.Parent.FocusLost:Connect(function(enterPressed) if enterPressed then script.Parent:CaptureFocus() end end)
If you add even the smallest yield before capturing the focus, this doesn’t happen:
script.Parent.FocusLost:Connect(function(enterPressed) if enterPressed then game:GetService("RunService").RenderStepped:Wait() script.Parent:CaptureFocus() end end)
I’m not entirely sure if this counts as a “bug” per se since it’s a problem with having no frames where the textbox isn’t focused, but it’s definitely unexpected behavior, as this character shouldn’t be showing up in the textbox and it’s not immediately apparent what’s causing it.