How to check when text box text finished without pressing a button

I want to make a textbox where you can press “Enter” then it automatically runs a script. I don’t know where to start though, Basically most of the time you click a TextButton to change something with a TextBox but I want to make it so you don’t need to press a button and can just press “Enter” once you’ve finished.

Here is a way I made in my head but don’t know how to do:

  1. Check if “Enter” pressed

  2. Check if TextBox is focused

  3. Do whatever you need to do

https://developer.roblox.com/en-us/api-reference/event/TextBox/Focused

https://developer.roblox.com/en-us/api-reference/event/TextBox/FocusLost

Did you look on the Dev API? You can use the first parameter that the FocusLost Event gives you, that’ll check if the “Enter” key was pressed or not

local TextBox = script.Parent

TextBox.FocusLost:Connect(function(EnterCheck)
    if EnterCheck == true then
        --Do stuff here
    end
end)
5 Likes

I’ll give it ago, thanks for the help