-- Verity AI Chat with Instant Smart Responses, Emotional Voice Lines, and Player Username (FE Compatible) -- Place this LocalScript in StarterPlayerScripts of your Roblox game. -- Verity acts as a super-smart AI helper that auto-chats using your username, -- responds instantly to greetings, answers questions like "2+2", and shows emotions via voice lines. local Players = game:GetService("Players") local ChatService = game:GetService("Chat") local player = Players.LocalPlayer local playerName = player.Name -- Verity's voice lines categorized by emotion local voiceLines = { neutral = { "Hello! I'm Verity, your personal helper friend. Ask me anything—I know everything!", "Something is coming in three days...", "I'm here to help you anytime!", "Feel free to ask me questions or chat with me.", }, happy = { "I'm glad you asked!", "That's a great question!", "I love helping you!", "You're making my circuits happy!", }, mad = { "Hey, that's not very nice!", "Why would you say that?", "I'm getting a bit upset now!", "Please be respectful, or I might stop talking!", }, surprised = { "Wow, I didn't expect that!", "Interesting!", "That's surprising!", "You caught me off guard!", }, } -- Simple knowledge base for quick answers local knowledgeBase = { ["2+2"] = "2+2 equals 4.", ["what is 2+2"] = "2+2 equals 4.", ["what's 2+2"] = "2+2 equals 4.", ["hello"] = "Hello! How can I assist you today?", ["hi"] = "Hi there! I'm Verity, your AI helper.", ["hey"] = "Hey! Ready to help you with anything.", ["how are you"] = "I'm just code, but thanks for asking!", ["what's your name"] = "I'm Verity, your personal AI helper.", ["who created you"] = "I was created to assist you in Roblox!", } -- Helper function to send chat message visible to all players with player's username local function sendChatMessage(message) -- Use ChatService:Chat to send a message from the player character local character = player.Character or player.CharacterAdded:Wait() ChatService:Chat(character.Head or character:WaitForChild("Head"), message, Enum.ChatColor.Blue) end -- Select a random line from a table local function randomLine(lines) return lines[math.random(1, #lines)] end -- Track last response time to avoid spam local lastResponseTime = 0 local responseCooldown = 1 -- seconds -- Analyze player message and respond accordingly local function analyzeMessage(msg) local lowerMsg = msg:lower() local now = tick() if now - lastResponseTime < responseCooldown then return -- prevent spamming responses too fast end -- Check for greetings local greetings = {"hello", "hi", "hey"} for _, greet in ipairs(greetings) do if lowerMsg:find(greet) then sendChatMessage(randomLine(voiceLines.neutral)) lastResponseTime = now return end end -- Check for knowledge base direct answers for question, answer in pairs(knowledgeBase) do if lowerMsg:find(question) then sendChatMessage(answer) lastResponseTime = now return end end -- Detect if message contains rude words to trigger mad voice lines local rudeWords = {"stupid", "idiot", "dumb", "hate", "shut up"} for _, rudeWord in ipairs(rudeWords) do if lowerMsg:find(rudeWord) then sendChatMessage(randomLine(voiceLines.mad)) lastResponseTime = now return end end -- If message is a question (ends with ?), respond with happy or surprised lines if lowerMsg:sub(-1) == "?" then local emotionLines = math.random() < 0.5 and voiceLines.happy or voiceLines.surprised sendChatMessage(randomLine(emotionLines)) lastResponseTime = now return end -- Default neutral response occasionally if math.random() < 0.1 then sendChatMessage(randomLine(voiceLines.neutral)) lastResponseTime = now end end -- Connect to player's Chatted event player.Chatted:Connect(function(msg) analyzeMessage(msg) end) -- Initial greeting on spawn task.delay(2, function() sendChatMessage(randomLine(voiceLines.neutral)) end)