Code_X

Chat GUI

Sep 5th, 2020
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  1. local gui = Instance.new("ScreenGui",game.CoreGui)
  2. gui.Name = "OutputGui"
  3. local Outputs = Instance.new("ScrollingFrame",gui)
  4. Outputs.Visible=false
  5. Outputs.BackgroundColor3=Color3.new(0,0,0)
  6. Outputs.BorderColor3=Color3.new(0,0,0)
  7. Outputs.BorderSizePixel=0
  8. Outputs.Position = UDim2.new(.675,0,.725,0)
  9. Outputs.Size=UDim2.new(.3,0,.2,0)
  10. Outputs.CanvasSize=UDim2.new(1.2,0,2,0)
  11. Outputs.ScrollBarThickness=6
  12. Outputs.ScrollingEnabled=true
  13. Outputs.CanvasPosition = Vector2.new(0, 10000)
  14. local Output = function(text)
  15. local color = Color3.new(1,1,1)
  16. local outputList = Outputs:GetChildren()
  17. for i,v in next,Outputs:GetChildren() do
  18. if v:IsA("StringValue") then
  19. table.remove(outputList, i)
  20. else
  21. v.Position = v.Position - UDim2.new(0,0,v.Size.Y.Scale/10,0)
  22. end
  23. end
  24. local NewOutputLine = Instance.new("TextLabel",Outputs)
  25. NewOutputLine.Text = text
  26. NewOutputLine.Size = UDim2.new(1,0,.15,0)
  27. NewOutputLine.Position = UDim2.new(0,0,.985,0)
  28. NewOutputLine.Font = "SourceSansBold"
  29. NewOutputLine.TextColor3 = color
  30. NewOutputLine.TextStrokeTransparency = 0
  31. NewOutputLine.BackgroundTransparency = 1
  32. NewOutputLine.BorderSizePixel = 0
  33. NewOutputLine.FontSize = "Size14"
  34. NewOutputLine.TextXAlignment = "Left"
  35. NewOutputLine.TextYAlignment = "Top"
  36. NewOutputLine.ClipsDescendants = true
  37. NewOutputLine.Name = "OutputLine"
  38. end
  39. local Visible = false
  40. local Open_Close = Instance.new("TextButton",gui)
  41. Open_Close.BackgroundColor3=Color3.new(0,0,0)
  42. Open_Close.BackgroundTransparency=0.5
  43. Open_Close.BorderColor3=Color3.new(0,0,0)
  44. Open_Close.BorderSizePixel=0
  45. Open_Close.Position=UDim2.new(.675,0,.9,0)
  46. Open_Close.Size=UDim2.new(.3,0,.025,0)
  47. Open_Close.Font=Enum.Font.SourceSansBold
  48. Open_Close.FontSize=Enum.FontSize.Size12
  49. Open_Close.Text="Chat Gui - Open"
  50. Open_Close.TextColor3=Color3.new(255,255,255)
  51. Open_Close.TextStrokeColor3=Color3.new(255,255,255)
  52. Open_Close.TextStrokeTransparency=1
  53. Open_Close.MouseButton1Click:connect(function()
  54. if Visible == false then
  55. Outputs.Visible = true
  56. Open_Close.Position = UDim2.new(.675, 0, .7, 0)
  57. Open_Close.Text = "Chat Gui - Close"
  58. Visible = true
  59. else
  60. Outputs.Visible = false
  61. Open_Close.Position = UDim2.new(.675, 0, .9, 0)
  62. Open_Close.Text = "Chat Gui - Open"
  63. Visible = false
  64. end
  65. end)
  66. for _,plr in next,game.Players:GetChildren() do
  67. if not plr:IsA("Player") then return end
  68. plr.Chatted:connect(function(msg)
  69. Output(plr.Name .. ": " .. msg)
  70. end)
  71. end
  72. game.Players.PlayerAdded:connect(function(plr)
  73. plr.Chatted:connect(function(msg)
  74. Output(plr.Name .. ": " .. msg)
  75. end)
  76. end)
Add Comment
Please, Sign In to add comment