Yayyyy that’s right and I’m gona help you about get colleting text
Ok so i’ve created away to continue the script without creating an error. This would happen because when testing for a string it would get nil (creating error).
local function searchlistaigreet(text)
for _, v in pairs(Greetings) do
if string.find(text, v) then
print('yes Greet')
createchat('ai', Greetings[math.random(1,#Greetings)])
ChatBox.Text = ""
return
end
end
return false
end
local function searchlistaimood(text)
for _, v in pairs(MoodStateQues) do
if string.find(text, v) == true then
print('yes Mood')
createchat('ai', MoodStateResp[math.random(1,#MoodStateResp)])
ChatBox.Text = ""
return
end
end
return false
end
local function searchlistaitroll(text)
for _, v in pairs(troll) do
if string.find(text, v) then
print('yes troll')
createchat('ai', trollresp[math.random(1,#trollresp)])
ChatBox.Text = ""
return
end
end
return false
end
local function onFocusLost(enterPressed)
if enterPressed then
createchat('plr', ChatBox.Text)
if searchlistaigreet(ChatBox.Text) == false then
if searchlistaimood(ChatBox.Text) == false then
searchlistaitroll(ChatBox.Text)
end
end
end
end
Still always creating a greeting response though. Do you know why?
What do you want It to output?
(Random Greetings or RandomALL)
When I ask how its mood is ex: how are you? it always responds with something like hey
Try change onFocusLost function to
local function onFocusLost(enterPressed)
if enterPressed then
searchlistaigreet(ChatBox.Text)
end
end
What will this do? this is close to what I am doing already.
Oh I’m sorry my baddd I should sleep T_T
Wait me pls
Can I have a chance?
mk goodnight! thanks for all the help
Oh you need to put true after blank return
Bye!! my mom gona punish me
k goodnight. now go fast! I don’t want you grounded
No no in my country they not want kid to grounded
They always hit their kid
Damn I know how that feels. If you ever need to talk hmu on discord Vonick#2728.
Ok I added if you need some help can text me anytime (If I’m awake lol)
I have the same issue, but for me i use #string.split(String,v)>1
if this not work use this #string.split(String,v)>0
I found that why I was always getting a greeting answer was because some of the text was over lapping. I’ve since fixed it.
Example:
Input (hey how are you!)
Greet {“yo”},
Mood {“how are you”},
Output finds you first