I’m trying to wait until the enter key is pressed and a textbox is focused, but I can’t figure it out, here’s some code that does not work lol.
function EnterKeyPressed(InputObject, GameProcessedEvent)
if InputObject.KeyCode == Enum.KeyCode.Return then
--idk
end
end
TextBox.Focused:Connect(function()
repeat wait() until --idk
end)
Try to add a boolean value like so,
local isPressed = false
function EnterKeyPressed(InputObject, GameProcessedEvent)
if InputObject.KeyCode == Enum.KeyCode.Return then
isPressed = true
end
end
TextBox.Focused:Connect(function()
repeat wait() until isPressed == true
end)
Hope this helps
1 Like
You can use FocustLost
and save some lines
TextBox.Focused:Connect(function()
print("Focused")
TextBox.FocusLost:Wait()
print("Focust lost")
end)
1 Like