i actually made a system like this:
local Messaging = {}
Messaging.__index = Messaging
local Personalities = {
Personality1 = {
hello = {
Message = "hii!!!!!!!!!!",
Response = {
["hi"] = {
Message = "im pro u nob!!!!!!!!!!!!!!!!!!!",
Quit = { ":(", "no im pro", "gun" },
},
sup = {
Message = "sup",
Response = {
ok = {
Message = "STOP IT.. IM THE CHILL ONE!",
Quit = { "mb", "you liar!!!!!!!!" },
},
},
Quit = { "..." },
},
},
Quit = { "im", "gonna", "gun you" },
},
youknowtoomuch = {
Message = "arent you the dud who slaughtered hundreds of our people????",
Quit = {
"What's need to be done shall be done. PANIC=TRUE",
"noo..? OwO??",
"its your turn PANIC=TRUE",
"*glock reloads* PANIC=TRUE",
"This is how society works 'round here PANIC=TRUE"
}
},
anotherpath = {
Message = "hello",
Respone = {
lel = {
Message = ">:(",
Quit = {">:( U TOO"}
}
},
Quit = {"hello", "bye", "ok", "no"}
},
idk = {
Message = "henloo",
Response = {
["hi?"] = {
Message = "ok?",
Response = {
["so uhh..."] = {
Message = "YOU IS DISRECPT RO FAMILE!",
Quit = {":(", "welp.. time to die PANIC=TRUE"}
},
["yeah..."] = {
Message = "ok man",
Response = {
["brainrot was harvards chosen word for 2025... we are cooked"] = {
Message = "yeah...",
Quit = {"welp.. TIME TO **** MYSELF, *tf2 reference*"}
},
["aoirnv302r3vj243-v4-23v42"] = {
Message = "gun you",
Quit = {"WELL I WILL! PANIC=TRUE"}
}
}
},
["*conversation here*"] = {
Message = `idkk`,
Quit = {"just retire", "can relate", "same"}
}
},
Quit = {"i have your family at hdr-47 point PANIC=TRUE", "ok...", "STOP IT PANIC=TRUE"}
},
["The FitnessGram™ Pacer Test is a multistage aerobic capacity test that progressively gets more difficult as it continues."] = {
Message = "The 20 meter pacer test will begin in 30 seconds.",
Response = {
["Line up at the start"] = {
Message = "The running speed starts slowly, but gets faster each minute after you hear this signal.",
Response = {
["[beep] A single lap should be completed each time you hear this sound"] = {
Message = "[ding] Remember to run in a straight line, and run as long as possible.",
Response = {
["The second time you fail to complete a lap before the sound, your test is over."] = {
Message = {"The test will begin on the word start."},
Response = {
["On your mark, get ready"] = {
Message = "START!!!",
Quit = {"we did it!!!!!!!!!!!!!!!!!!!!!!!!!!"}
}
},
Quit = {"i forgo"}
}
},
Quit = {"i forgo"}
}
},
Quit = {"i forgo"}
}
},
Quit = {"i forgo"}
},
["sir, the roblox hq has fallen"] = {
Message = "ok",
Quit = {"your family has been crushed under the rubble... PANIC=TRUE"}
}
},
Quit = {"no.", "????", "stawpppp", "goodbye zzirrrrrrrrrr"}
}
},
Personality2 = {
wedawwd = {
Message = "Goodday, bruv!",
Response = {
["Bwi 'ish person eh?"] = {
Message = "JUST CUZ' IM BWI 'ISH BRUV?",
Quit = { "yuh laddie" },
},
OI = {
Message = "OI BRUV WHAT U WANT",
Response = {
RAHRAHRAH = {
Message = "i gun",
Quit = { "gun, h", "h" },
},
},
Quit = { "oiiooioioioioioi" },
},
},
Quit = { "message1", "test", "bye", "goodbye" },
},
other = {
Message = "Want some crumpts?",
Response = {
["CRUMPETS INNIT!"] = {
Message = "Oi, want crumpets or not?",
Quit = {"ID PREFER ME TEA!", "THE EPIC DUCK IS COMING!"}
},
["sure bruv"] = {
Message = "im actually broke...",
Quit = {"RICH DUDE, YA OWE ME A 20!", "knew it"}
}
},
Quit = { "no mate", "id prefer me tea instead" },
},
},
Personality9999 = {
counting = {
Message = "oh money money.. OH.. hello peasant",
Response = {
["I have gun"] = {
Message = "mb gng ill back up now",
Response = {
["pls giv mony"] = {
Message = "NO!",
Quit = {"Then die. PANIC=TRUE"}
}
},
Quit = {"Just go peasant."}
}
},
Quit = {"ok i shoot", "j"}
},
money = {
Message = "*counting bills*",
Quit = {"*steals cash*"}
}
}
}
local DEFAULT_QUIT = { "Goodbye!" }
function Messaging.new(npc)
local self = setmetatable({}, Messaging)
self.NPC = npc
local pid = npc:GetAttribute("Personality") or 1
self.Personality = Personalities["Personality" .. pid] or Personalities.Personality1
local keys = {}
for k in self.Personality do
table.insert(keys, k)
end
local key = keys[math.random(#keys)]
self.CurrentNode = self.Personality[key]
self.NextKey = nil
return self
end
function Messaging:GetMessage()
if not self.CurrentNode then
return nil, nil, DEFAULT_QUIT
end
local Msg = self.CurrentNode.Message
local Quits = self.CurrentNode.Quit or DEFAULT_QUIT
local Key
if self.CurrentNode.Response then
local Choices = {}
for k in pairs(self.CurrentNode.Response) do
table.insert(Choices, k)
end
if #Choices > 0 then
Key = Choices[math.random(1, #Choices)]
end
end
self.NextKey = Key
local QuitMsg = Quits[math.random(1, #Quits)]
if string.find(QuitMsg, " PANIC=TRUE") then
local new = string.gsub(QuitMsg, " PANIC=TRUE", "")
return Msg, Key, new, true
end
return Msg, Key, QuitMsg
end
function Messaging:Forward()
local key = self.NextKey
if not key or not self.CurrentNode or not self.CurrentNode.Response then
self.CurrentNode = nil
return nil, nil, nil
end
local nextNode = self.CurrentNode.Response[key]
if not nextNode then
self.CurrentNode = nil
return nil, nil, nil
end
self.CurrentNode = nextNode
self.NextKey = nil
return self:GetMessage()
end
return Messaging