I’m trying to make a chatbot, but I can’t do this because string:find() is case sensitive.
I tried
string.lower()
but it still doesn’t work.
Please help me.
I’m trying to make a chatbot, but I can’t do this because string:find() is case sensitive.
I tried
string.lower()
but it still doesn’t work.
Please help me.
What exactly have you tried? Lower does work, however it is near impossible to help you with your problem unless you post the full code that doesn’t work.
local Text = "The SomEthiNg tHing"
local TextToFilter = "Something"
Text = Text:lower()
TextToFilter = TextToFilter:lower()
local FoundAt = string.find(Text,TextToFilter)
if FoundAt then
print("A text '",TextToFilter,"' found at ",FoundAt)
else
print("Text '",TextToFilter,"' not found.")
end
It’s because TextToFilter
variable starts with capitalized S.
That way, when you turn Text
into lowercase it won’t match because something ~= Something
.
To fix this, simply replace the capitalized S in TextToFilter
to lowercase s, and it will work.
Did you read completely??
Please do not reply without reading to the end.
Oh yeah. I didn’t notice this, but calm down a little buddy. My bad. (thought that you’re the OP at first)
elseif script.Parent.Parent.TextBox.Text:find("noob")
and script.Parent.Parent.TextBox.Text:find("you")
then
script.Parent.Parent.TextLabel.Text = "Bot is typing..."
wait(math.random(1,2.5))
script.Parent.Parent.TextLabel.Text = "I'm not noob."
Where are you calling lower?
Have you tried something like this?
local textBox = script.Parent.Parent.TextBox;
...
elseif textBox.Text:lower():find("noob")
and textBox.Text:lower():find("you")
then
script.Parent.Parent.TextLabel.Text = "Bot is typing..."
wait(math.random(1,2.5))
script.Parent.Parent.TextLabel.Text = "I'm not noob."
is there an any way to [TextBox]:find(“text”) not case sentisive
Thank you so much! I didn’t know it’s that easy to fix.
Can you check my post?
I suggest marking the answer that helped you as a Solution.
Have a nice day, and goodluck in your projects!