DoorTamer
(DoorTamer)
#1
Hello. I am trying to create a search bar, but for that I need the script to only get a specific part and proceed it as a variable, for example;
The script:
local y = string.lower(textBox.Text)
print(y)
if y == ‘roblox’ then
label.Text = ‘Roblox is a multiplayer platform for all ages.’
If a player types ‘roblox game’ instead of ‘roblox’ nothing triggers. Is there a way I can trigger if the keyword is close?
10 Likes
Inctus
(Inctus)
#2
2 Likes
Autterfly
(Autterfly)
#3
You can also check using string.find
, which also has an option to not match using Lua patterns if you don’t need to.
4 Likes
You can use string.find:
local str = "Roblox is a cool game"
str = str:lower()
if str:find("roblox") then
print("found it in string")
end
53 Likes