local logFile = "ChatLogs.txt" if not isfile(logFile) then writefile(logFile, "[ Chat Log Started - " .. os.date("%x %X") .. " ]\n\n") end local function log(name, msgType, message) local timestamp = os.date("[%H:%M:%S]") local logLine = string.format("%s [%s] (%s): %s\n", timestamp, name, msgType, message) appendfile(logFile, logLine) end for _, plr in pairs(game:GetService("Players"):GetPlayers()) do plr.Chatted:Connect(function(msg) log(plr.Name, "Chatted", msg) end) end game:GetService("Players").PlayerAdded:Connect(function(plr) plr.Chatted:Connect(function(msg) log(plr.Name, "Chatted", msg) end) end) local chatEvent = game:GetService("ReplicatedStorage"):WaitForChild("DefaultChatSystemChatEvents", 10) if chatEvent then local onMessage = chatEvent:FindFirstChild("OnMessageDoneFiltering") if onMessage then onMessage.OnClientEvent:Connect(function(data) log(data.FromSpeaker, data.OriginalChannel, data.Message) end) end end rconsoleprint("@@GREEN@@[Chat Logger] Logging all chat types to: " .. logFile .. "\n")