Advertisement
Guest User

chatLogger

a guest
Nov 17th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.47 KB | None | 0 0
  1. _G.KeyBind = Enum.KeyCode.K; --default: K
  2. _G.Scaled = false; --default: false
  3.  
  4. local awrite = true
  5.  
  6. local a, b = pcall(function()
  7.     if writefile then
  8.         awrite = false
  9.     end
  10. end)
  11.  
  12. if awrite == false then
  13.     local ChatLogs = Instance.new("ScreenGui")
  14.     local Back = Instance.new("Frame")
  15.     local TopBar = Instance.new("Frame")
  16.     local TitleTxt = Instance.new("TextLabel")
  17.     local TextLabel = Instance.new("TextLabel")
  18.     local TextLabel_2 = Instance.new("TextLabel")
  19.     local ChatLogs_2 = Instance.new("ScrollingFrame")
  20.     local ExampleChatThing = Instance.new("Frame")
  21.     local Namee = Instance.new("TextLabel")
  22.     local ChatMsg = Instance.new("TextLabel")
  23.     local UIListLayout = Instance.new("UIListLayout")
  24.     local plrs = game:GetService("Players")
  25.     local uis = game:GetService("UserInputService")
  26.  
  27.     local function ranString()
  28.         local chars = {
  29.             "a",
  30.             "A",
  31.             "b",
  32.             "B",
  33.             "c",
  34.             "C",
  35.             "d",
  36.             "D",
  37.             "e",
  38.             "E",
  39.             "f",
  40.             "F",
  41.             "g",
  42.             "G",
  43.             "h",
  44.             "H",
  45.             "i",
  46.             "I",
  47.             "j",
  48.             "J",
  49.             "k",
  50.             "K",
  51.             "l",
  52.             "L",
  53.             "m",
  54.             "M",
  55.             "n",
  56.             "N",
  57.             "o",
  58.             "O",
  59.             "p",
  60.             "P",
  61.             "q",
  62.             "Q",
  63.             "r",
  64.             "R",
  65.             "s",
  66.             "S",
  67.             "t",
  68.             "T",
  69.             "u",
  70.             "U",
  71.             "v",
  72.             "V",
  73.             "w",
  74.             "W",
  75.             "x",
  76.             "X",
  77.             "y",
  78.             "Y",
  79.             "z",
  80.             "Z",
  81.             "1",
  82.             "2",
  83.             "3",
  84.             "4",
  85.             "5",
  86.             "6",
  87.             "7",
  88.             "8",
  89.             "9",
  90.             "0"
  91.         }
  92.         local str = ""
  93.         for i = 1, 10 do
  94.             local num = math.random(1, #chars)
  95.             local ch = chars[num]
  96.             str = str..ch
  97.         end
  98.         return str;
  99.     end
  100.  
  101.     ChatLogs.Name = ranString()
  102.     ChatLogs.Parent = game:GetService("CoreGui")
  103.     ChatLogs.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  104.  
  105.     Back.Name = "Back"
  106.     Back.Parent = ChatLogs
  107.     Back.BackgroundColor3 = Color3.new(1, 1, 1)
  108.     Back.BorderSizePixel = 0
  109.     Back.Position = UDim2.new(0.695, 0, 0.738, 0)
  110.     Back.Size = UDim2.new(0.3, 0, 0.25, 0)
  111.     Back.Active = true
  112.     Back.Draggable = true
  113.  
  114.     TopBar.Name = "TopBar"
  115.     TopBar.Parent = Back
  116.     TopBar.BackgroundColor3 = Color3.new(1, 1, 1)
  117.     TopBar.BackgroundTransparency = 0.75
  118.     TopBar.Size = UDim2.new(1, 0, 0.100000001, 0)
  119.  
  120.     TitleTxt.Name = "TitleTxt"
  121.     TitleTxt.Parent = TopBar
  122.     TitleTxt.BackgroundColor3 = Color3.new(1, 1, 1)
  123.     TitleTxt.BackgroundTransparency = 1
  124.     TitleTxt.Position = UDim2.new(0.0199999996, 0, 0, 0)
  125.     TitleTxt.Size = UDim2.new(0.699999988, 0, 0.899999976, 0)
  126.     TitleTxt.Font = Enum.Font.SourceSansBold
  127.     TitleTxt.Text = "CHAT LOGGER"
  128.     TitleTxt.TextColor3 = Color3.new(0, 0, 0)
  129.     TitleTxt.TextScaled = true
  130.     TitleTxt.TextSize = 14
  131.     TitleTxt.TextWrapped = true
  132.     TitleTxt.TextXAlignment = Enum.TextXAlignment.Left
  133.  
  134.     ChatLogs_2.Name = "ChatLogs"
  135.     ChatLogs_2.Parent = Back
  136.     ChatLogs_2.BackgroundColor3 = Color3.new(1, 1, 1)
  137.     ChatLogs_2.BackgroundTransparency = 1
  138.     ChatLogs_2.BorderSizePixel = 0
  139.     ChatLogs_2.Position = UDim2.new(0, 0, 0.100000001, 0)
  140.     ChatLogs_2.Size = UDim2.new(1, 0, 0.9, 0)
  141.     ChatLogs_2.CanvasSize = UDim2.new(0, 0, 300, 0)
  142.     ChatLogs_2.ScrollBarImageColor3 = Color3.new(0, 0, 0)
  143.     ChatLogs_2.ScrollBarThickness = 8
  144.  
  145.     ExampleChatThing.Name = "ExampleChatThing"
  146.     ExampleChatThing.Parent = ChatLogs_2
  147.     ExampleChatThing.BackgroundColor3 = Color3.new(1, 1, 1)
  148.     ExampleChatThing.BackgroundTransparency = 1
  149.     ExampleChatThing.Size = UDim2.new(0.98, 0, 0, 25)
  150.     ExampleChatThing.Visible = false
  151.  
  152.     Namee.Name = "Namee"
  153.     Namee.Parent = ExampleChatThing
  154.     Namee.BackgroundColor3 = Color3.new(1, 1, 1)
  155.     Namee.BackgroundTransparency = 1
  156.     Namee.Position = UDim2.new(0.01, 0, 0, 0)
  157.     Namee.Size = UDim2.new(0.23, 0, 0.75, 0)
  158.     Namee.Font = Enum.Font.SourceSans
  159.     Namee.Text = "[player]:"
  160.     Namee.TextColor3 = Color3.new(0, 0, 0)
  161.     Namee.TextScaled = false
  162.     Namee.TextSize = 14
  163.     Namee.TextWrapped = true
  164.     Namee.TextXAlignment = Enum.TextXAlignment.Left
  165.  
  166.     ChatMsg.Name = "ChatMsg"
  167.     ChatMsg.Parent = ExampleChatThing
  168.     ChatMsg.BackgroundColor3 = Color3.new(1, 1, 1)
  169.     ChatMsg.BackgroundTransparency = 1
  170.     ChatMsg.Position = UDim2.new(0.25, 0, 0, 0)
  171.     ChatMsg.Size = UDim2.new(0.75, 0, 1.14, 0)
  172.     ChatMsg.Font = Enum.Font.SourceSans
  173.     ChatMsg.Text = "message"
  174.     ChatMsg.TextColor3 = Color3.new(0, 0, 0)
  175.     ChatMsg.TextSize = 14
  176.     ChatMsg.TextWrapped = true
  177.     ChatMsg.TextXAlignment = Enum.TextXAlignment.Left
  178.     ChatMsg.TextYAlignment = Enum.TextYAlignment.Top
  179.  
  180.     if getrenv()._G.Scaled then
  181.         if getrenv()._G.Scaled == true then
  182.             ChatMsg.TextScaled = true
  183.         else
  184.             ChatMsg.TextScaled = false
  185.         end
  186.     end
  187.  
  188.     UIListLayout.Parent = ChatLogs_2
  189.     UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder
  190.     UIListLayout.Padding = UDim.new(0, 1)
  191.  
  192.     if _G.KeyBind then
  193.         uis.InputBegan:Connect(function(input, pro)
  194.             if input.UserInputType == Enum.UserInputType.Keyboard then
  195.                 if not pro and input.KeyCode == _G.KeyBind then
  196.                     Back.Visible = not Back.Visible
  197.                 end
  198.             end
  199.         end)
  200.     end
  201.  
  202.     local logString;
  203.     local nString = ""
  204.  
  205.     local function logMsg(plr, message)
  206.         local datat = os.date("*t", os.time())
  207.         nString = nString.."["..datat["hour"]..":"..datat["min"]..":"..datat["sec"].."] ["..plr.Name.."]: "..message.."\n"
  208.         logString = nString
  209.         local msgUi = ExampleChatThing:Clone()
  210.         msgUi.ChatMsg.Text = message
  211.         msgUi.Namee.Text = "["..plr.Name.."]:" 
  212.         msgUi.Parent = ChatLogs_2
  213.         msgUi.Name = "message"
  214.         msgUi.Visible = true
  215.     end
  216.  
  217.     for i, v in pairs(plrs:GetPlayers()) do
  218.         v.Chatted:Connect(function(message)
  219.             logMsg(v, message)
  220.         end)
  221.     end
  222.  
  223.     plrs.PlayerAdded:Connect(function(plr)
  224.         plr.Chatted:Connect(function(message)
  225.             logMsg(plr, message)
  226.         end)
  227.     end)
  228. else
  229.     warn("...")
  230. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement