Text Detector Output GUI

I want to make a GUI called output that spits out a certain line of words when it detects certain words being typed into a textbox GUI. How would I do this?

1 Like

Something like this should work:

local myTextBox = script.Parent
local stringToFind = 'string'

myTextBox:GetPropertyChangedSignal('Text'):Connect(function() -- listens for the 'text' property to change.
    if string.find(myTextBox.Text, stringToFind) then -- if the string is contained within your query
        print('Found the string!')
    end
end)

If you wanted an array of strings, you could do something like this:

local myStrings = {'string', 'epic string', 'even epicer string'}

myTextBox:GetPropertyChangedSignal('Text'):Connect(function() -- listens for the 'text' property to change.
    for index,stringToFind in pairs(myStrings) do -- iterates through each string in the array above
        if string.find(myTextBox.Text, stringToFind) then -- if the string is contained within your query
            print('Found the string!')
        end
    end
end)
1 Like

This doesn’t print the code out into another textlabel, though. I’m looking for something that does that, otherwise this would work. Thanks.

Oh, alright. Just add this:

local myTextLabel = script.Parent -- wherever your textlabel is

Add this below the print/replace the print with it:

myTextLabel.Text = 'whatever you want the string to be'
2 Likes

Thank you so much! This will help a great deal.

1 Like

Is there anyway I could make the string print out whatever the player types in?

1 Like

Yeah, for sure. Just add `print(myTextBox.Text) right after this line: