Hello, I want to make something very cool but I cannot do that because I am confused. So if I have a sentence like “Hey man what’s up?” (Pretend a player typed that) and I was to search the keyword up, how would I do that? I’m not talking about the Crtl+Find thing. I want to make a search by keyword thing.
local stringg = 'Hello world!'
if stringg:find('wor') then
print('You found me!')
else
print('lol')
end
1 Like
There’s this nice little thing called string.find. I find it helpful to look into it. Here is the page for strings: string | Roblox Creator Documentation I suggest you look into it because there may be another way, I just cant remember any of these.
To add to this, you can also use string.match
local stringg = 'Hello world!'
if stringg:match('wor') then
print('You found me!')
else
print('lol')
end
They do the same if you’re just using them in an if statement, but for other uses, find
just returns the indices (start and end) at which the first match was located or nil
and match
returns the first instance of the matched string or nil
2 Likes
Thanks so much man! I actually never learned strings yet sadly but I will now start learning strings. I actually forgot to learn strings.
1 Like