I was just working on a text box to use in my UI, and it was working perfectly fine, no issues. Then I closed studio, left for like 30 minutes, came back and now the cursor is not moving to new lines when I click enter. This stumped me, I was honestly super confused why it was happening now when I never changed my code. I asked ChatGPT to see if it had anything to say about why this could be happening but it was only bringing up how I’m using automatic height Y for the textbox. This is what happens: If you start typing on line 1, click enter, line 2 is created and the cursor moves down. If you click enter again on line 2, line 3 is created but the cursor stays on line 2. If you start typing, it will snap to line 3. In a seperate instance, if you start typing on any line, and try to click enter, it will create the new line but won’t move the cursor to the new line. I tried to look for some other solutions other than ChatGPT, but I can’t find anything relating to this issue anywhere. The specific element with the issue is codeBoxText1.
local function CreateCodeBox(text : string, typeable : boolean): Frame
local codeBox1 = Instance.new("Frame")
codeBox1.AutomaticSize = Enum.AutomaticSize.Y
codeBox1.Size = UDim2.new(1, 0, 0, 0)
codeBox1.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
codeBox1.BorderSizePixel = 0
local uiList = Instance.new("UIListLayout")
uiList.SortOrder = Enum.SortOrder.LayoutOrder
uiList.FillDirection = Enum.FillDirection.Horizontal
uiList.Parent = codeBox1
local corner = Instance.new("UICorner")
corner.CornerRadius = UDim.new(0, 4)
corner.Parent = codeBox1
local lineNumbers = Instance.new("TextLabel")
lineNumbers.Size = UDim2.new(0, 24, 0, 0)
lineNumbers.TextXAlignment = Enum.TextXAlignment.Right
lineNumbers.TextYAlignment = Enum.TextYAlignment.Top
lineNumbers.TextColor3 = Color3.fromRGB(129, 129, 129)
lineNumbers.Font = Enum.Font.Code
lineNumbers.AutomaticSize = Enum.AutomaticSize.Y
lineNumbers.TextSize = 14
lineNumbers.BackgroundTransparency = 1
lineNumbers.BorderSizePixel = 0
lineNumbers.LayoutOrder = 1
lineNumbers.Text = "1"
lineNumbers.Parent = codeBox1
local numberPadding = Instance.new("UIPadding")
numberPadding.PaddingRight = UDim.new(0, 8)
numberPadding.Parent = lineNumbers
local codeBoxText1 = Instance.new("TextBox")
codeBoxText1.TextEditable = typeable
codeBoxText1.MultiLine = true
codeBoxText1.ClearTextOnFocus = false
codeBoxText1.AutomaticSize = Enum.AutomaticSize.Y
codeBoxText1.Size = UDim2.new(1, 0, 0, 0)
codeBoxText1.Position = UDim2.new(0, 0, 0, 0)
if text then
codeBoxText1.Text = text
else
codeBoxText1.Text = ""
end
codeBoxText1.PlaceholderText = [[local function ExampleCode(a,b)
print("And Here!")
end]]
codeBoxText1.PlaceholderColor3 = Color3.fromRGB(129,129,129)
codeBoxText1.TextWrapped = true
codeBoxText1.TextColor3 = Color3.fromRGB(129, 129, 129)
codeBoxText1.TextSize = 14
codeBoxText1.FontFace = Font.new("rbxasset://fonts/families/GothamSSm.json", Enum.FontWeight.SemiBold, Enum.FontStyle.Normal)
codeBoxText1.TextXAlignment = Enum.TextXAlignment.Left
codeBoxText1.TextYAlignment = Enum.TextYAlignment.Top
codeBoxText1.BackgroundTransparency = 1
codeBoxText1.BorderSizePixel = 0
codeBoxText1.LayoutOrder = 2
codeBoxText1.Parent = codeBox1
local padding = Instance.new("UIPadding")
padding.PaddingTop = UDim.new(0, 4)
padding.PaddingBottom = UDim.new(0, 6)
padding.PaddingLeft = UDim.new(0, 6)
padding.PaddingRight = UDim.new(0, 6)
padding.Parent = codeBox1
return codeBox1
end
I’m honestly really stuck, it was just working and now it’s not. Also, this is being used in a plugin, I don’t know if that matters but I wanted to include that. Also, I just have the local version of the plugin so maybe that could also be causing issues I have no idea. Here’s a video: https://youtu.be/lFErjjkskD4