--[[ Roblox Chat Command Enhancer (LocalScript) Adds extra chat commands & text modifiers Commands: !chat reverse !chat corrupted !chat mimic !chat mimic stop Text modifiers: #smile -> 😃 #sad -> 😔 /n -> newline Other: >console -> prints to console $execute -> executes Lua code (local) NOTE: - LocalScript only affects YOUR client. - Uses TextChatService (new chat). Falls back if needed. - $execute is powerful. Use only for testing. ]]-- local Players = game:GetService("Players") local TextChatService = game:GetService("TextChatService") local LocalPlayer = Players.LocalPlayer local mimicTarget = nil local isMimicking = false -- ========================= -- Utility functions -- ========================= local function reverseString(str) return str:reverse() end local function corruptString(str) local chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+-=" local result = {} for i = 1, #str do local ch = str:sub(i, i) if math.random() < 0.35 then table.insert(result, chars:sub(math.random(1, #chars), math.random(1, #chars))) else table.insert(result, ch) end end return table.concat(result) end local function applyTextModifiers(text) text = text:gsub("#smile", "😃") text = text:gsub("#sad", "😔") text = text:gsub("/n", "\n") return text end local function sendMessage(text) if TextChatService.ChatVersion == Enum.ChatVersion.TextChatService then TextChatService.TextChannels.RBXGeneral:SendAsync(text) else game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents.SayMessageRequest:FireServer(text, "All") end end -- ========================= -- Command handler -- ========================= local function handleCommand(message) -- !chat reverse local rev = message:match("^!chat%s+reverse%s+(.+)") if rev then sendMessage(reverseString(rev)) return true end -- !chat corrupted local cor = message:match("^!chat%s+corrupted%s+(.+)") if cor then sendMessage(corruptString(cor)) return true end -- !chat mimic stop if message == "!chat mimic stop" then isMimicking = false mimicTarget = nil warn("Mimic stopped") return true end -- !chat mimic local targetName = message:match("^!chat%s+mimic%s+(%w+)") if targetName then for _, plr in ipairs(Players:GetPlayers()) do if plr.Name:lower():sub(1, #targetName) == targetName:lower() then mimicTarget = plr isMimicking = true warn("Now mimicking:", plr.Name) return true end end end -- >console local con = message:match("^>console%s+(.+)") if con then print("[Console Message]", con) return true end -- $execute local exec = message:match("^%$execute%s+(.+)") if exec then local f, err = loadstring(exec) if f then f() else warn("Execute error:", err) end return true end return false end -- ========================= -- Mimic listener -- ========================= local function setupMimic(plr) if TextChatService.ChatVersion == Enum.ChatVersion.TextChatService then plr.Chatted:Connect(function(msg) if isMimicking and plr == mimicTarget then sendMessage(msg) end end) end end for _, p in ipairs(Players:GetPlayers()) do setupMimic(p) end Players.PlayerAdded:Connect(setupMimic) -- ========================= -- Main chat hook -- ========================= if TextChatService.ChatVersion == Enum.ChatVersion.TextChatService then TextChatService.OnIncomingMessage = function(message) if message.TextSource and message.TextSource.UserId == LocalPlayer.UserId then local text = message.Text -- modifiers text = applyTextModifiers(text) -- commands if handleCommand(text) then return TextChatService:CreateTextMessage("", message.TextSource) end return TextChatService:CreateTextMessage(text, message.TextSource) end return message end else LocalPlayer.Chatted:Connect(function(msg) local modified = applyTextModifiers(msg) if handleCommand(modified) then return end sendMessage(modified) end) end