I find that the script fails to work and I cannot find the source to where it is failing to place a string the textlabel. Here is the script:
local plrs = game:GetService('Players')
local lp = plrs.LocalPlayer
local ChatBox = script.Parent
local replicatedstorage = game:GetService('ReplicatedStorage')
local ManageFrame = script.Parent.Parent
local msgcloner = script.Parent.Parent.MsgCloner
Greetings = {
"Hello",
"Hi",
"hello",
"hi",
"Hola",
"hola",
"yo",
"Yo",
"Hi!",
"hi",
"Howdy",
"howdy",
}
local function createchat(origin, text)
for i,v in pairs(msgcloner:GetChildren()) do
local msgpieces = v:Clone()
local msgbase = msgcloner:Clone()
wait()
msgbase.Parent = ManageFrame
msgpieces.Parent = msgbase
msgbase.BackgroundTransparency = 0.2
msgbase.TextTransparency = 0
if origin == "ai" then
msgbase.Position = UDim2.new(0.028, 0.692, 0)
msgbase.Text = text
ChatBox.Text = ""
else
msgbase.Position = UDim2.new(0.653, 0, 0.692, 0)
msgbase.Text = text
ChatBox.Text = ""
end
end
end
local function searchlistai(text)
print('plss')
for i, v in pairs(Greetings) do
if string.find(v, text) then
createchat('ai', v[math.random(1,11)])
end
end
end
local function onFocusLost(enterPressed)
if enterPressed then
createchat('plr', ChatBox.Text)
searchlistai(ChatBox.Text)
end
end
ChatBox.FocusLost:Connect(onFocusLost)
The print placed where I should be searching for a value in table fails. Meaning the function wont even load. What is going on here?