local WEBHOOK_URL = "Put Webhook Here" local CONFIG = { BotName = "Chat Logger", ServerName = "Roblox", EmbedColor = 3066993, Cooldown = 0, } local Players = game:GetService("Players") local TextChatService = game:GetService("TextChatService") local lastSent = 0 local function httpRequest(data) if syn and syn.request then syn.request(data) elseif request then request(data) elseif http and http.request then http.request(data) elseif http_request then http_request(data) else warn("[ChatLogger] HTTP EROR") end end local function sendWebhook(playerName, userId, message, channel) local now = tick() if now - lastSent < CONFIG.Cooldown then task.wait(CONFIG.Cooldown - (now - lastSent)) end lastSent = tick() local avatarUrl = "https://thumbnails.roblox.com/v1/users/avatar-headshot?userIds=" .. userId .. "&size=48x48&format=Png" local profileUrl = "https://www.roblox.com/users/" .. userId .. "/profile" local safeMsg = message:gsub('\\','\\\\'):gsub('"','\\"'):gsub('\n','\\n') local body = '{' .. '"username":"' .. CONFIG.BotName .. '",' .. '"embeds":[{' .. '"color":' .. CONFIG.EmbedColor .. ',' .. '"author":{"name":"' .. playerName .. '","url":"' .. profileUrl .. '","icon_url":"' .. avatarUrl .. '"},' .. '"description":"```' .. safeMsg .. '```",' .. '"fields":[' .. '{"name":"Channel","value":"' .. (channel or "Genel") .. '","inline":true},' .. '{"name":"User ID","value":"' .. tostring(userId) .. '","inline":true},' .. '{"name":"Server","value":"' .. CONFIG.ServerName .. '","inline":true}' .. '],' .. '"footer":{"text":"' .. os.date("%d.%m.%Y %H:%M") .. '"}' .. '}]}' task.spawn(function() pcall(httpRequest, { Url = WEBHOOK_URL, Method = "POST", Headers = { ["Content-Type"] = "application/json" }, Body = body, }) end) end local function hookChannel(channel) channel.MessageReceived:Connect(function(msg) local source = msg.TextSource if not source then return end local player = Players:GetPlayerByUserId(source.UserId) if not player then return end sendWebhook( player.Name .. " (" .. player.DisplayName .. ")", player.UserId, msg.Text, channel.Name ) end) end local channels = TextChatService:FindFirstChild("TextChannels") if channels then for _, ch in ipairs(channels:GetChildren()) do if ch:IsA("TextChannel") then hookChannel(ch) end end channels.ChildAdded:Connect(function(ch) if ch:IsA("TextChannel") then hookChannel(ch) end end) print("[ChatLogger] Sending.") else warn("[ChatLogger] TextChannels not finded.") end