Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

FocusLost not working?

Asked by 8 years ago

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!

0
This only works in Studio. Please help NewVoids 97 — 8y
0
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 User#11440 120 — 8y

Answer this question