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.
local function FocusLost(enterPressed) if enterPressed then -- stuff end) script.Parent.FocusLost:connect(FocusLost)
It may be you forgot the 'end' to close the 'if then' statement.
local function FocusLost(enterPressed) if enterPressed then --stuff end -- You forgot this. end) script.Parent.FocusLost:Connect(FocusLost) -- They changed it so it's recommended to use ':Connect' instead of ':connect'.
I hope this helped.
script.Parent.FocusLost:connect(function(enterPressed) if enterPressed then --stuff end end)