Hello everyone, I have code that will write out the text you put into one textbox into another.
I looked on the wiki about something I can use to detect when I press enter to lose focus on a textbox and I found TextBox.FocusLost.
On the wiki, it says that the first parameter is enterPressed, which is boolean to tell me if someone lost focus on a textbox by pressing enter.
When I try pressing enter on the textbox, it doesn't print anything and if I click off, the output says: "Player pressed Enum.KeyCode.Unknown", even though I pressed enter.
Does someone know how to fix this? Thanks!
Code:
local writeBox = script.Parent
local autoWriteBox = writeBox.Parent.AutoWriteBox
writeBox.FocusLost:Connect(function(enterPressed, inputThatCausedFocusLost)
if enterPressed then
print("Player pressed Enter")
else
print("Player pressed", inputThatCausedFocusLost.KeyCode)
end
end)

2 comments
I solved this because my textbox was broken and I just made a new one and it works fine now.
Btw this was a local script.