Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Jun 13th, 2018 445 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. if game:service('RunService'):IsStudio() then print('!STUDIO!') else
  2.     if game:service('CoreGui'):findFirstChild('LogHolder') then return nil
  3.     end
  4. end
  5.  
  6. local LogHolder = Instance.new("ScreenGui")
  7. local Logs = Instance.new("Frame")
  8. local Scroll = Instance.new("ScrollingFrame")
  9. local Template = Instance.new("TextLabel")
  10.  
  11. LogHolder.Name = "LogHolder"
  12. if game:service('RunService'):IsStudio() then LogHolder.Parent = game.Players.LocalPlayer.PlayerGui else
  13.     LogHolder.Parent = game.CoreGui
  14. end
  15.  
  16. Logs.Name = "Logs"
  17. Logs.Parent = LogHolder
  18. Logs.AnchorPoint = Vector2.new(0.5, 0.5)
  19. Logs.BackgroundColor3 = Color3.new(1, 1, 1)
  20. Logs.Position = UDim2.new(0.200000003, 0, 0.200000003, 0)
  21. Logs.Size = UDim2.new(0, 400, 0, 250)
  22. Logs.Style = Enum.FrameStyle.DropShadow
  23.  
  24. Scroll.Name = "Scroll"
  25. Scroll.Parent = Logs
  26. Scroll.BackgroundColor3 = Color3.new(1, 1, 1)
  27. Scroll.BackgroundTransparency = 1
  28. Scroll.BorderSizePixel = 0
  29. Scroll.Size = UDim2.new(1, 0, 1, 0)
  30. Scroll.CanvasSize = UDim2.new(0, 0, 0, 0)
  31. Scroll.ScrollBarThickness = 6
  32.  
  33. Template.Name = "Template"
  34. Template.Parent = Logs
  35. Template.BackgroundColor3 = Color3.new(1, 1, 1)
  36. Template.BackgroundTransparency = 1
  37. Template.Position = UDim2.new(0, 0, 0, -25)
  38. Template.Size = UDim2.new(1, 0, 0, 20)
  39. Template.Font = Enum.Font.ArialBold
  40. Template.Text = ""
  41. Template.TextColor3 = Color3.new(1, 1, 1)
  42. Template.TextSize = 15
  43. Template.TextXAlignment = Enum.TextXAlignment.Left
  44. Template.TextWrap = true
  45.  
  46. Logs.Active = true
  47. Logs.Draggable = true
  48.  
  49. local loggedTable = {}
  50.  
  51. local getTotalSize = function()
  52. local totalSize = UDim2.new(0, 0, 0, 0)
  53.    
  54.     for i, v in next, loggedTable do
  55.         totalSize = totalSize + UDim2.new(0, 0, 0, v.Size.Y.Offset)
  56.     end
  57.    
  58.     return totalSize
  59. end
  60.  
  61. local BUD = UDim2.new(0, 0, 0, 0)
  62. local TotalNum = 0
  63.  
  64. local function GenLog(txt, colo, time)
  65.     local oldColo = Color3.fromRGB(0, 0, 0)
  66.    
  67.     local Temp = Template:Clone()
  68.     Temp.Parent = Scroll
  69.     Temp.Name = txt..'Logged'
  70.     Temp.Text = tostring(txt)
  71.     Temp.Visible = true
  72.     Temp.Position = BUD + UDim2.new(0, 0, 0, 0)
  73.     if colo then oldColo = colo Temp.TextColor3 = colo elseif not colo then Temp.TextColor3 = Color3.fromRGB(200, 200, 200) end
  74.  
  75.     local timeVal = Instance.new('StringValue', Temp)
  76.     timeVal.Name = 'TimeVal'
  77.     timeVal.Value = time
  78.  
  79.     TotalNum = TotalNum + 1
  80.    
  81.     if not Temp.TextFits then repeat Temp.Size = UDim2.new(Temp.Size.X.Scale, Temp.Size.X.Offset, Temp.Size.Y.Scale, Temp.Size.Y.Offset + 10)
  82.         Temp.Text = txt
  83.     until Temp.TextFits
  84. end
  85.  
  86.     BUD = BUD + UDim2.new(0, 0, 0, Temp.Size.Y.Offset)
  87.    
  88.     table.insert(loggedTable, Temp)
  89.    
  90.     local totSize = getTotalSize()
  91.    
  92.     if totSize.Y.Offset >= Scroll.CanvasSize.Y.Offset then Scroll.CanvasSize = UDim2.new(totSize.X.Scale, totSize.X.Offset, totSize.Y.Scale, totSize.Y.Offset + 100)
  93.     Scroll.CanvasPosition = Scroll.CanvasPosition + Vector2.new(0, totSize.Y.Offset)
  94.     end
  95.    
  96.     return Temp
  97. end
  98.  
  99. local ChatData = ""
  100.  
  101. local function SaveToFile()
  102.     local t = os.date("*t")
  103.     local dateDat = t['hour']..' '..t['min']..' '..t['sec']..' '..t['day']..'.'..t['month']..'.'..t['year']
  104.    
  105.     ChatData = ""
  106.    
  107.     for i, v in pairs(Scroll:GetChildren()) do
  108.         ChatData = ChatData..v.TimeVal.Value..' '..v.Text..'\n'
  109.     end
  110.    
  111.     writefile('ChatLogs '..dateDat..'.txt', ChatData)
  112. end
  113.  
  114.  
  115. local function Clear()
  116.     loggedTable = {}
  117.     ChatData = ""
  118.     Scroll.CanvasPosition = Vector2.new(0, 0)
  119.     for i, v in pairs(Scroll:GetChildren()) do
  120.         v:Destroy()
  121.     end
  122.     Scroll.CanvasSize = UDim2.new(0, 0, 0, 0)
  123.     BUD = UDim2.new(0, 0, 0, 0)
  124. end
  125.  
  126. local LogPlr = function(plr)
  127.             plr.Chatted:connect(function(msg)
  128.                
  129.             local t = os.date("*t")
  130.             local dateDat = t['hour']..':'..t['min']..':'..t['sec']
  131.    
  132.             if string.len(msg) >= 1000 then return nil end
  133.             if string.lower(msg) == 'clear' and plr == game:service('Players').LocalPlayer then Clear() return nil end
  134.             if string.lower(msg) == 'savetofile' and plr == game:service('Players').LocalPlayer then SaveToFile() return nil end
  135.             if string.sub(msg, 1, 1):match('%p') and string.sub(msg, 2, 2):match('%a') and string.len(msg) >= 5 then GenLog(plr.Name..': '..msg, Color3.new(255, 0, 0), dateDat) else
  136.             GenLog(plr.Name..': '..msg, Color3.new(255, 255, 255), dateDat)
  137.             end
  138.     end)
  139. end
  140.  
  141. for i, v in pairs(game.Players:GetChildren()) do
  142.     LogPlr(v)
  143. end
  144.  
  145. game.Players.PlayerAdded:connect(function(plr)
  146.     LogPlr(plr)
  147. end)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top