Hey Developers my issue with this script is that the function is getting called even when not saying words in the table.
local Words = {
"no",
"yes",
"maybe",
"monkey"
}
Here is my table and heres the script
else
for _,v in Words do
if v:lower():match(message:lower()) then
KidnapPlayer(player)
break
end
end
end
Everything works fine apart from a few random phrases also triggering the player to get kidnapped.
This doesn’t happen for every word you say just random ones that are not apart of the table. Any help would be appreciated.
I think you need the &
symbol somewhere in the query. Not sure though.
1 Like
The issue is that you’re using match()
which searches for a pattern. Instead, use find()
with plain text search.
1 Like
running into the same problem and yes doesn’t trigger the van anymore. Any help?
else
for _,v in Words do
if v:lower():find(message:lower()) then
KidnapPlayer(player)
end
break
end
end
I’ve discovered that with the new code it only works with the first value in the table which is “no”
I fixed it with this code thanks for all the help!
else
for _,v in Words do
if v:lower() == (message:lower()) then
KidnapPlayer(player)
break
end
end
end