I am trying to make a script where if a player says a certain word they will get a tool. For example, if a player says sword, they will get a sword in their backpack. This is what I have so far.
local tools = game.Lighting.Sword
local tool = game.Lighting.Bow
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
-------------------------------------------------Dialogue---------------------------
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 input.Text == "sword" or input.Text == "Sword" or input.Text == "Bow" then
output.Text = "Great choice! I knew you would pick the " .. response .. "!"
else
response = raw_input("What? What is a " .. response .. "? Please pick a sword or bow.")
output.Text = "Great choice! I knew you would pick the " .. response .. "!"
end
if input.Text == "sword" or input.Text == "Sword" then
tools:Clone().Parent = player.Backpack
end
if input.Text == "Bow" or input.Text == "bow" then
tool:Clone().Parent = player.Backpack
end

1 comment
Don't use Lighting to store tools, use ServerStorage or ReplicatedStorage