Advertisement
Jaden11

Chat gui I made ROBLOX

Dec 29th, 2014
388
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.19 KB | None | 0 0
  1. clone = script.Parent.Default:Clone()
  2.  
  3. frontsize = 30
  4. buffer = 5
  5. lines = 10
  6.  
  7. linesize = fontsize + buffer * 2
  8. script.Parent.Size = UDim2.new(0.3, 0, 0, linesize * lines)
  9. script.Parent.Default.Position = UDim2.new(0, 0, 0, linesize * lines - linesize)
  10. script.Parent.Default.FontSize = "Size"..fontsize
  11. --------------------------------------
  12.  
  13. ranks = { [1] = "Enlist",
  14. [2] = "Private",
  15. [3] = "Corporal",
  16. [4] = "Sergeant",
  17. [5] = "Staff Sergeant",
  18. [6] = "First Sergeant",
  19. [7] = "Sergeant Major",
  20. [8] = "Warrant Officer",
  21. [9] = "Second Lieutenant",
  22. [10] = "First Lieutenant",
  23. [11] = "CiT",
  24. [12] = "DP",
  25. [12+1] = "Captain",
  26. [13+1] = "Major",
  27. [14+1] = "Colonel",
  28. [15+1] = "Major General",
  29. [16+1] = "Lieutenant General",
  30. [17+1] = "General",
  31. [18+1] = "Commander"
  32. }
  33.  
  34. function shiftup()
  35. for _, a in pairs(script.Parent:GetChildren()) do
  36. if a.Name == "Chat" then
  37. shared[a].True = shared[a].True + UDim2.new(0, 0, 0, -linesize)
  38. a:TweenPosition(shared[a].True, "Out", "Quad", 0.157, true)
  39. end
  40. end
  41. end
  42. function Chat(msg, plr, rankoverride)
  43. shiftup()
  44. local text = clone:Clone()
  45. text.Visible = true
  46. text.Text = msg
  47. text.Name = "Chat"
  48. if plr:IsInGroup(226584) or rankoverride then
  49. if not rankoverride then
  50. local rank = Player:GetRankInGroup(226584)
  51. else
  52. rank = rankoverride
  53. end
  54. text.Text = "["..ranks[rank].."] "..plr.Name..": "..text.Text
  55. if rank >= 13 then
  56. text.TextColor3 = Color3.new(0, 0, 127/225)
  57. else
  58. text.TextColor3 = Color3.new(28/225, 43/225, 1)
  59. end
  60. else
  61. text.Text = "[Visitor] "..plr.Name..": "..text.Text
  62. end
  63. text.Position = text.Position + UDim2.new(0, 0, 0, linesize)
  64. text.Parent = script.Parent
  65. text:TweenPosition(UDim2.new(0, 0, 0, linesize * lines - linesize), "Out", "Quad", 0.157, true)
  66. shared[text] = {}
  67. shared[text].True = UDim2.new(0, 0, 0, linesize * lines - linesize)
  68. Lines = text.TextBounds.Y / fontsize --18 is the font size
  69. for i = 1, Lines - 1 do
  70. shiftup()
  71. end
  72. text.Size = UDim2.new(1, 0, 0, linesize * Lines)
  73. game:GetService("Debris"):AddItem(text, 60)
  74. end
  75.  
  76. game.Players.PlayerAdded:connect(function (plr)
  77. plr.Chatted:connect(function (m)
  78. Chat(m, plr)
  79. end)
  80. end)
  81.  
  82. for _, plr in pairs(game.Players:GetChildren()) do
  83. plr.Chatted:connect(function (m)
  84. Chat(m, plr)
  85. end)
  86. end
  87.  
  88. _G.chat = Chat
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement