I'm trying to make a script that a model replies to a player when a player says something that has a certain keyword before, after, or both. Is it possible to do it that way?
local PlayerKeywords1 = {
"yo",
"ye",
"hello",
"hi",
"wassup",
"sup",
"hellur",
"ni hao",
"hola",
"hai"
}
local PlayerKeywords2 = {
"good",
"g00d",
"nice",
"great"
}
local PlayerKeywords3 = {
"uw0tm8",
"u w0t m8",
"y u",
"wuv",
"luv",
"w0t",
"w8",
"fien"
}
local PlayerKeywords4 = {
"pie",
"food",
"trains",
"houses",
"toilets",
"power",
"roblox",
"robloxians",
"celebrities",
"people",
"world",
"youtube",
"twitter",
"ig",
"instagram",
"studio"
}
local PlayerKeywords5 = {
"ikr",
"i know right",
"okay",
"ok",
"kk",
"k",
"kay",
"kai",
"what",
"really",
"crazy",
"bad",
"whet",
"heh",
"huh",
"sorry"
}
local PlayerKeywords6 = {
":o",
":/",
";o",
";)",
";')",
":)",
";(",
";'(",
":(",
":3",
"?",
"?.?",
"OoO",
"O>O",
"v.v",
">.>",
"<.<",
"(>^.^)>",
"<(^.^<)",
"^.^",
":I",
":|",
"o.o",
":P",
"xD",
"XD",
"xd",
"c:",
":c",
"c;",
";c",
";'c",
"C:",
"C;",
"C;",
"o-o",
}
local PlayerKeywords7 = {
"bye",
"bai",
"cya",
"see ya",
"later",
"peace",
"dueces",
"goodbye",
"gudbye",
"g00dbai",
"goodbai",
"gudbai",
"g00dbye"
}
local Dialog1 = {
"Wassup bruh?",
"yeeee supppp",
"Hello, mate!",
"hi :3",
"sup..",
"Wassup... geez..",
"What is that?",
"I DUNT SPEAK YO LANGUAGE!!1!1!",
"haiiii!!!"
}
local Dialog2 = {
"Thank ya!",
"Thanks!",
"Thank you!",
"You're great!"
}
local Dialog3 = {
"i dunt want chu",
"i dunt want chuuu",
"w0t",
"i wuv u 2",
"i luv u 2",
"w0t 2 u 2",
"wait 4 w0t?",
"thank chu!!1!1!"
}
local Dialog4 = {
"I like pie!",
"Ew food!",
"Eh, trains arn't that bad..",
"houses....house..HOUSE!!",
"By the way, I need to go pee!!!",
"I OVAP0W3R CHU!!",
"Roblox is fun! But it gets boring after awhile",
"I dunt knoe...",
"I'm not a mainstream person..",
"People.. I like people!",
"Global warming is bad...",
"Youtube, we broadcast everywhere!",
"Follow me on twitter! I'm NoobyNoobCaiks!",
"I rarely get on instagram... so.",
"Roblox studio is a twist!"
}
local Dialog5 = {
"I knoww",
"I knowww",
"mhm",
"okay..",
"Huh?",
"Yes really.",
"yeah ik u cray cray 2",
"yah im badddd",
"Yasss",
"hehehehe c:",
"*stares*",
"It's okay! c:",
}
local Dialog6 = {
"o-o",
"I don't like faces!"
}
local Dialog7 = {
"Goodbye!"
}
local DialogExtra = {
"I don't understand you..",
"ye okay *doesn't understand*",
"Don't quite understand ya!",
"What...",
"Really? That language scares me...",
"I understand bruh!!! *doesn't understand*",
">.> <.< *runs*",
"So much weird languageeee",
"Hey, I don't really understand."
}
function StartChat(Plr)
for _,v in pairs(game.Workspace:GetChildren()) do
if (v:IsA("Model")) then
if v:findFirstChild("Humanoid") ~= nil then
if v:findFirstChild("Torso") ~= nil then
if (script.Parent.Position - v:findFirstChild("Torso").Position).magnitude <= 5 then
Plr.Chatted:connect(function(msg)
if msg:lower():sub(1,2) == {PlayerKeywords1[4],msg}
end)
end
end
end
end
end
end
