How to see whats the player write in TextBox inside the text

I don’t know how to write in title but
I allways to know what the plr write in TextBox i used the

path.TextBox.Text

but now i want to know what the plr write inside… for example

In the TextBox its saying dkaçsdakl.HI.dajdsajl

I want to know if the “HI” is inside the text or not.

mine is not perfect but here’s my version

local text = nil

while true do
      wait(1)
      text = path.TextBox.Text
      print(text)
end

I’m not sire if this works, I need to open my scripts on what I wrote

1 Like

But i want to the script knows if inside the text of the player has a word
in my example

this is whats the player write in TextBox, i want to make a script to search the word “HI” inside this Text.

if text == "hi" then
     print("hello")
end
1 Like

There are two ways we can do this, you either create redeem button or you listen for Enter key as UIS event. How to find HI? I am pretty sure that there exists a string function named “match” that will help u with that one

1 Like

look into string.gmatch() and string patterns.

1 Like

But this is if the entire text has “hi” but the “hi” its in the middle of the text

you can make your own split function which will split the string into an array on every ‘.’ then use a for loop to check if the string == “HI”

1 Like

Oh, so we might have to loop inside using a for loop to look in the word “hi”

1 Like

but how i make this loop search the word?
(I can’t understand the google examples)
U can make this the more simple u can in a script?

I usually do this (probably not the best idea)


local text = path.TextBox

text:GetPropertyChangedSignal("Text"):Connect(function()
    if text.Text == nil or text.Text == "" then return end
    print(text.Text)
end)
1 Like

You can check this topic
Sorry if you were not looking for this

3 Likes

You can use string.find():

Text = "wadiwqndHIdwqndn"
wordToSearchFor = "HI"

if string.find(Text, wordToSearchFor) then
    print("Word has been found")
end
6 Likes