Chatbot Script Help

So im trying to create a script where if you send a specific message to a bot it says something back.

Firstly I want the capitilzation not to matter but I need help to do that

I’ve tried this script however I dont know whats wrong with it. Their are no errors or anything.

local Response = script.Parent.Response

local TextBox = script.Value.Value

while true do

wait (1)

local TextBox = string.lower(TextBox)

if (TextBox == “insert text here”) then

Response.Text = “Did you even type anything”

end

end

1 Like

Instead of using loop which can be exhausting over time, use .Changed. So, a script can detect if the value of textbox changed using that.

Also for local TextBox = script.Value.Value your going to want to do local TextBox = script.Parent.Value.Value because there is no way to have a value in a script like you had it, you were defining a property inside the script called “Value” which does not exist.

1 Like

The local script has a child named “Value” in it. So I’d have to keep it as script.Value.Value

No you wouldn’t, when you do script.Value.Value that is searching for a property inside the script itself. Also, if your so definite about it not being script.Parent.Value.Value then do script:WaitForChild("Value").Value.

image

Look, you can ask others, script.Value.Value is going into the script, looking for a property inside the script named “Value”, and looking inside “Value” for “Value”.

script.Parent.Value.Value is the correct way to do it, or if you want script:WaitForChild("Value").Value

Is incorrect once I tested it I got an error. image

And

is exactly the same as script.Value.Value

My bad, your right, I thought the value was inside the frame :sweat_smile:

You should change local TextBox = script.Value.Value
Instead, make it local TextBox = script.Value

And when you do local TextBox = string.lower(TextBox)
Change it to TextBox = string.lower(TextBox.Value)
Don’t make it local, since it already exists.

Also, I have made a simple chatbot, click here if you want it: