I am trying to make something that if someone types something other than a certain word into this text box, it will return something different than if they said what they were supposed to say. For example, in my script that I'm trying to make, a question comes up asking "Would you like a bow or a sword?" and I want people who say sword or bow to get a different response than they would get if they say something random like noodles.
This is what I have so far:
local input = script.Parent.TextBox
local output = script.Parent.TextLabel
local function raw_input(prompt)
local text = ""
output.Text = prompt
input:CaptureFocus()
local event = input.FocusLost:connect(function(enterPressed)
if enterPressed and input.Text ~= "" then
text = input.Text
else
input:CaptureFocus()
end
end)
repeat wait() until text ~= ""
return text
end
local response = raw_input("What is your name?")
output.Text = "Hello, " .. response .. "!"
repeat wait(2) until text ~= ""
response = raw_input("Would you like to go on a quest?")
output.Text = "" .. response .. "? You didn't have a choice. It was always going to be yes."
wait(3)
response = raw_input("You will need a weapon. Would you like a bow or sword?")
if input.Text = "bow" or "sword" then
output.Text = "Great choice! I knew you would pick the " .. response .. "!"
else
output.Text = "What? What is a " .. response .. "? Please pick a sword or bow."
end
