I made a script that does this
- when text box focus is lost
- clear text
- wait until enter is released
- capture focus again
- replace the text
to try and move the cursor to the beginning of the textbox when the focus was lost. It works visually and you can see the cursor at the beginning of the box, but when you actually input another letter it just acts as if the cursor is at the end.
here is the script, if you paste it inside a textbox you can see the problem. Is this a bug?
local sp = script.Parent
sp.ClearTextOnFocus = false
sp.FocusLost:connect(function(enterpressed)
if enterpressed == true then
local text = sp.Text
sp.Text = ""
repeat
local key = game:GetService("UserInputService").InputEnded:wait()
until key.KeyCode == Enum.KeyCode.Return
sp:CaptureFocus()
sp.Text = text
end
end)
