So I used this block of code, and it doesn't trigger when I press enter while editing a TextBox. I'm testing this in the actual game, not studio.
1 | local function FocusLost(enterPressed) |
2 | if enterPressed then |
3 | -- stuff |
4 | end ) |
5 |
6 | script.Parent.FocusLost:connect(FocusLost) |
It may be you forgot the 'end' to close the 'if then' statement.
1 | local function FocusLost(enterPressed) |
2 | if enterPressed then |
3 | --stuff |
4 | end -- You forgot this. |
5 | end ) |
6 |
7 | script.Parent.FocusLost:Connect(FocusLost) -- They changed it so it's recommended to use ':Connect' instead of ':connect'. |
I hope this helped.
1 | script.Parent.FocusLost:connect( function (enterPressed) |
2 | if enterPressed then |
3 | --stuff |
4 | end |
5 | end ) |