local HttpService = game:GetService("HttpService") local Players = game:GetService("Players") local TextChatService = game:GetService("TextChatService") -- REMINDER: Replace this if you've updated your Webhook for security! local WEBHOOK_URL = "https://discord.com/api/webhooks/1493319955595137044/kI9w8SUOvGPjl9LFa5mzto88O9hC27zXl1xa9qxPWXdME7FfJKLSeRweQ9hDvcP0oW_4" local function sendToDiscord(name, msg) local data = { ["content"] = name .. ": " .. msg } local request = (syn and syn.request) or (http and http.request) or http_request or request if request then request({ Url = WEBHOOK_URL, Method = "POST", Headers = { ["Content-Type"] = "application/json" }, Body = HttpService:JSONEncode(data) }) else pcall(function() HttpService:PostAsync(WEBHOOK_URL, HttpService:JSONEncode(data)) end) end end -- METHOD 1: Modern Roblox Chat (TextChatService) -- This catches messages as they are received by the client TextChatService.MessageReceived:Connect(function(textChatMessage) if textChatMessage.TextSource then local senderName = textChatMessage.TextSource.Name local messageText = textChatMessage.Text sendToDiscord(senderName, messageText) end end) -- METHOD 2: Legacy Chat / General Player Chatted -- This ensures that even if Method 1 isn't used by the game, we still catch it local function setupPlayer(plr) plr.Chatted:Connect(function(msg) -- We only use this if TextChatService isn't active to avoid double logging if TextChatService.ChatVersion == Enum.ChatVersion.LegacyChatService then sendToDiscord(plr.Name, msg) end end) end for _, player in pairs(Players:GetPlayers()) do setupPlayer(player) end Players.PlayerAdded:Connect(setupPlayer)