rtvr56565
(rtvr56565)
February 19, 2021, 11:17am
#1
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
rtvr56565
(rtvr56565)
February 19, 2021, 11:24am
#3
But i want to the script knows if inside the text of the player has a word
in my example
rtvr56565:
dkaçsdakl.HI.dajdsajl
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
rtvr56565
(rtvr56565)
February 19, 2021, 11:27am
#7
But this is if the entire text has “hi” but the “hi” its in the middle of the text
rtvr56565:
dkaçsdakl.HI.dajdsajl
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
rtvr56565
(rtvr56565)
February 19, 2021, 11:31am
#10
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?
shabman
(shab)
February 19, 2021, 11:31am
#11
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
AntinotyY
(Anti)
February 19, 2021, 11:32am
#12
You can check this topic
Sorry if you were not looking for this
3 Likes
walshuk
(vincenzo)
February 19, 2021, 11:33am
#13
You can use string.find():
Text = "wadiwqndHIdwqndn"
wordToSearchFor = "HI"
if string.find(Text, wordToSearchFor) then
print("Word has been found")
end
6 Likes