Alright, so I'm trying to check if the enter key was pressed on a textbox, and it works in Studio. However, it doesn't work in game. I've put a wait(1) before it and it still isn't working. Can anyone troubleshoot this code?
game.Players.PlayerAdded:connect(function(player) wait(1) player.PlayerGui.Chat.Frame.TextBox.FocusLost:connect(function(enter) if enter then print('Pressed enter') end end) end)
This doesn't give any errors, and it's running in a server script. I'm also sure it is the focuslost event not working because I did print(1) after playeradded, print(2) after the event. It didnt print 2.
Thanks!

2 comments
This only works in Studio. Please help
When FE is on, scripts can't access PlayerGui. That might be your problem as it would cause similar errors. To fix a problem like this, use a local script in starterpack without the player added function. You could get the player by using LocalPlayer