This script is supposed to detect when a player says anything with the words "What", "He", and "Do", or "What", "It", and "Do", or "What", "You", and "Do".
However, while it does so just fine, it also detects "He", "It", and "You" in any context with or without the other words.
01 | words = { |
02 | -- [ "Explain Function" ] |
03 | words = { |
04 | { "What" , "It" , "Do" } , |
05 | { "What" , "He" , "Do" } , |
06 | { "What" , "You" , "Do" } , |
07 | } , |
08 | func = function ( p ) -- functions go HERE |
09 | print (p.Name .. " asked Faraday to explain his function" ) |
10 | game.ServerScriptService.FaraVoice.Value = "Currently I am programmed to respond to certain phrases, however soon I will run this house." |
11 | wait( 0.3 ) |
12 | local text = game.ServerScriptService.FaraVoice.Value |
13 | local y = game:GetService( "Chat" ):Chat(Interfaces, "" ..text, Enum.ChatColor.Green) |
14 | end |
15 | } |
You altered the code I gave you in a way that makes it work really differently. I don't really even know what your word sort algorithm results in. Anyways, I updated the same one I made you yesterday to do what you want.
Should be straightforward
01 | match = nil |
02 |
03 | phrases = { |
04 | [ "Amour" ] = { |
05 | words = { |
06 | { "Jarvis" , "Armour" , "pls" } , |
07 | { "Jarvis" , "Armour" } , |
08 | { "Jarvis" , "Give" , "Armour" } |
09 | } , |
10 | func = function ( p ) -- functions go HERE |
11 | print (p.Name .. " activated armor function" ) |
12 | end |
13 | } , |
14 | [ "Health" ] = { |
15 | words = { |
1 | function onChatted(message, recipient, speaker) |
2 | local actualRecipient = "Admin" |
3 | if recipient = = actualRecipient then |
4 | --The rest of your code there. |
5 | end |
6 | end |
That's because it happens anytime when the player chats.
I believe the solution is for you to specify the recipient that should respond and if the recipient argument matches the variable, then the function executes.
The above code does that for you. You can paste your code within the if/then. If the recipient is the wanted recipient, then your function should check the words.