Sorry I cant show you the actual script because I dont want it to be leaked, but heres what I got:
I have a function hooked up to make it so that when you press the Enter key, It prints whats inside a Textbox.
The only problem is, you have to click enter twice when typing in the Textbox. Once to Exit out of the Textbox, and once to print. How do I make it so that you only need to press Enter once?
I guess I can put this small part of the script down:
Num=1 Mouse.KeyDown:connect(function(Key) -- When the player presses a key if Key == string.char(13) then -- If the player Pressed the enterkey AddText(Num.."> "..Textbox.Text) -- Thats a custom function that works. It prints to a custom Console. Textbox:CaptureFocus() Num=Num+1 end end)
You may want to listen to the FocusLost
event of the textbox. This fires every time focus on the textbox is lost, either via clicking out of the textbox or pressing enter.
Num=1 Textbox.FocusLost:connect(function(enterPressed) -- check if pressing enter caused the textbox to lose focus if enterPressed then AddText(Num.."> "..Textbox.Text) Textbox:CaptureFocus() -- ?? Num=Num+1 end end)