Advertisement
Rovo112

Cross chat

Feb 19th, 2015
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.84 KB | None | 0 0
  1. local Gui = script.Parent
  2. local Player = Gui.Parent.Parent
  3. local MsgsF = Gui.MsgsF
  4. local Font_Sizes = {
  5. {symbol=" ",X=7,Y=27},
  6. {symbol=" ",X=28,Y=27},
  7. {symbol="!",X=7,Y=27},
  8. {symbol=[["]],X=9,Y=27},
  9. {symbol="#",X=14,Y=27},
  10. {symbol="$",X=14,Y=27},
  11. {symbol="%",X=22,Y=27},
  12. {symbol="&",X=17,Y=27},
  13. {symbol="'",X=5,Y=27},
  14. {symbol="(",X=9,Y=27},
  15. {symbol=")",X=9,Y=27},
  16. {symbol="*",X=10,Y=27},
  17. {symbol="+",X=15,Y=27},
  18. {symbol=",",X=7,Y=27},
  19. {symbol="-",X=9,Y=27},
  20. {symbol=".",X=7,Y=27},
  21. {symbol="/",X=7,Y=27},
  22. {symbol="0",X=14,Y=27},
  23. {symbol="1",X=14,Y=27},
  24. {symbol="2",X=14,Y=27},
  25. {symbol="3",X=14,Y=27},
  26. {symbol="4",X=14,Y=27},
  27. {symbol="5",X=14,Y=27},
  28. {symbol="6",X=14,Y=27},
  29. {symbol="7",X=14,Y=27},
  30. {symbol="8",X=14,Y=27},
  31. {symbol="9",X=14,Y=27},
  32. {symbol=":",X=7,Y=27},
  33. {symbol=";",X=7,Y=27},
  34. {symbol="<",X=15,Y=27},
  35. {symbol="=",X=15,Y=27},
  36. {symbol=">",X=15,Y=27},
  37. {symbol="?",X=14,Y=27},
  38. {symbol="@",X=26,Y=27},
  39. {symbol="A",X=17,Y=27},
  40. {symbol="B",X=17,Y=27},
  41. {symbol="C",X=18,Y=27},
  42. {symbol="D",X=18,Y=27},
  43. {symbol="E",X=17,Y=27},
  44. {symbol="F",X=16,Y=27},
  45. {symbol="G",X=20,Y=27},
  46. {symbol="H",X=18,Y=27},
  47. {symbol="I",X=7,Y=27},
  48. {symbol="J",X=13,Y=27},
  49. {symbol="K",X=17,Y=27},
  50. {symbol="L",X=14,Y=27},
  51. {symbol="M",X=21,Y=27},
  52. {symbol="N",X=18,Y=27},
  53. {symbol="O",X=20,Y=27},
  54. {symbol="P",X=17,Y=27},
  55. {symbol="Q",X=20,Y=27},
  56. {symbol="R",X=18,Y=27},
  57. {symbol="S",X=17,Y=27},
  58. {symbol="T",X=16,Y=27},
  59. {symbol="U",X=18,Y=27},
  60. {symbol="V",X=17,Y=27},
  61. {symbol="W",X=24,Y=27},
  62. {symbol="X",X=17,Y=27},
  63. {symbol="Y",X=17,Y=27},
  64. {symbol="Z",X=16,Y=27},
  65. {symbol="[",X=7,Y=27},
  66. {symbol=[[\]],X=7,Y=27},
  67. {symbol="]",X=7,Y=27},
  68. {symbol="^",X=12,Y=27},
  69. {symbol="_",X=14,Y=27},
  70. {symbol="`",X=9,Y=27},
  71. {symbol="a",X=14,Y=27},
  72. {symbol="b",X=14,Y=27},
  73. {symbol="c",X=13,Y=27},
  74. {symbol="d",X=14,Y=27},
  75. {symbol="e",X=14,Y=27},
  76. {symbol="f",X=7,Y=27},
  77. {symbol="g",X=14,Y=27},
  78. {symbol="h",X=14,Y=27},
  79. {symbol="i",X=6,Y=27},
  80. {symbol="j",X=6,Y=27},
  81. {symbol="k",X=13,Y=27},
  82. {symbol="l",X=6,Y=27},
  83. {symbol="m",X=21,Y=27},
  84. {symbol="n",X=14,Y=27},
  85. {symbol="o",X=14,Y=27},
  86. {symbol="p",X=14,Y=27},
  87. {symbol="q",X=14,Y=27},
  88. {symbol="r",X=9,Y=27},
  89. {symbol="s",X=13,Y=27},
  90. {symbol="t",X=7,Y=27},
  91. {symbol="u",X=14,Y=27},
  92. {symbol="v",X=13,Y=27},
  93. {symbol="w",X=18,Y=27},
  94. {symbol="x",X=13,Y=27},
  95. {symbol="y",X=13,Y=27},
  96. {symbol="z",X=13,Y=27},
  97. {symbol="{",X=9,Y=27},
  98. {symbol="|",X=7,Y=27},
  99. {symbol="}",X=9,Y=27},
  100. {symbol="~",X=15,Y=27}}
  101.  
  102. function getTextLength(Text)
  103. local FSize = 11
  104. local Size = 0
  105. for z=1, #Text do
  106. local text = string.sub(Text,z,z)
  107. for _,Symbol in pairs(Font_Sizes) do
  108. if text == Symbol.symbol then
  109. Size = Size+(Symbol.X*(FSize/19.1))
  110. break
  111. end
  112. end
  113. end
  114. return Size
  115. end
  116.  
  117. MsgsF.ChildAdded:connect(function(Child)
  118. local Msgs = MsgsF:children()
  119. if #Msgs > 10 then
  120. Msgs[1]:remove()
  121. end
  122. end)
  123.  
  124. function Chat(Msg,PlayerChatted)
  125. local Msgs = MsgsF:children()
  126. local MsgN = Instance.new("TextButton")
  127. local MsgT = Instance.new("TextButton")
  128. MsgN.Name = "ChatMessage"
  129. MsgN.BorderSizePixel = 0
  130. MsgN.FontSize = Enum.FontSize.Size11
  131. MsgN.AutoButtonColor = false
  132. MsgN.BackgroundColor3 = Color3.new(0,0,0)
  133. if #Msgs > 0 then
  134. MsgN.Position = Msgs[#Msgs].Position + UDim2.new(0,0,0,20)
  135. end
  136. MsgN.Parent = MsgsF
  137. MsgT.Name = "Message"
  138. MsgT.BorderSizePixel = 0
  139. MsgT.FontSize = Enum.FontSize.Size11
  140. MsgT.AutoButtonColor = false
  141. MsgT.Text = " "..Msg.." "
  142. if MsgT.Text == "Button" then
  143. MsgT.Text = " [ Content Deleted ] "
  144. end
  145. MsgT.Size = UDim2.new(0,getTextLength(MsgT.Text),0,20)
  146. MsgT.Position = UDim2.new(1,0,0,0)
  147. MsgT.BackgroundColor3 = Color3.new(0,0,0)
  148. MsgT.Parent = MsgN
  149. if PlayerChatted == "[ Game ]" then
  150. MsgN.Text = " [ Game ] : "
  151. MsgN.Size = UDim2.new(0,getTextLength(MsgN.Text),0,20)
  152. MsgN.TextColor3 = Color3.new(0,0,0)
  153. MsgT.TextColor3 = Color3.new(0,0,0)
  154. elseif PlayerChatted == "[ Help Bot ]" then
  155. MsgN.Text = " [ Help Bot ] : "
  156. MsgN.Size = UDim2.new(0,getTextLength(MsgN.Text),0,20)
  157. MsgN.TextColor3 = Color3.new(0,0,0)
  158. MsgT.TextColor3 = Color3.new(0,0,0)
  159. else
  160. MsgN.Text = " "..PlayerChatted.Name.." : "
  161. MsgN.Size = UDim2.new(0,getTextLength(MsgN.Text),0,20)
  162. if PlayerChatted == Player then
  163. MsgN.TextColor3 = Color3.new(1,0,0)
  164. MsgT.TextColor3 = Color3.new(1,0,0)
  165. elseif PlayerChatted:IsBestFriendsWith(Player.userId) then
  166. MsgN.TextColor3 = Color3.new(0.5,0,1)
  167. MsgT.TextColor3 = Color3.new(0.5,0,1)
  168. elseif PlayerChatted:IsFriendsWith(Player.userId) then
  169. MsgN.TextColor3 = Color3.new(0,0,1)
  170. MsgT.TextColor3 = Color3.new(0,0,1)
  171. else
  172. MsgN.TextColor3 = Color3.new(0,1,0)
  173. MsgT.TextColor3 = Color3.new(0,1,0)
  174. end
  175. end
  176. for i = 0, 1, 0.2 do
  177. MsgN.BackgroundTransparency = 1-(i*0.2)
  178. MsgN.TextTransparency = 1-i
  179. MsgT.BackgroundTransparency = 1-(i*0.1)
  180. MsgT.TextTransparency = 1-i
  181. wait(0.1)
  182. end
  183. local Fade = Instance.new("ImageLabel")
  184. Fade.BorderSizePixel = 0
  185. Fade.BackgroundTransparency = 1
  186. Fade.Image = "http://www.roblox.com/asset/?id=36469741"
  187. Fade.Size = UDim2.new(0,MsgN.Size.X.Offset+MsgT.Size.X.Offset,0,20)
  188. Fade.Parent = MsgN
  189. end
  190.  
  191. for _,PlayerChatted in pairs(game.Players:children()) do
  192. PlayerChatted.Chatted:connect(function(Msg) Chat(Msg,PlayerChatted) end)
  193. end
  194.  
  195. game.Players.ChildAdded:connect(function(PlayerChatted)
  196. PlayerChatted.Chatted:connect(function(Msg) Chat(Msg,PlayerChatted) end)
  197. end)
  198.  
  199. game.Chat.Chatted:connect(function(Obj,Msg)
  200. local player = game.Players:playerFromCharacter(Obj)
  201. if not player and Obj.Name == "Head" and Obj:findFirstChild("Dialog") == nil then
  202. Chat(Msg, "[ Help Bot ]")
  203. end
  204. end)
  205.  
  206. while true do wait(0.1)
  207. for i,Msg in pairs(MsgsF:children()) do
  208. local WantY,CurY = (i-1)*20,Msg.Position.Y.Offset
  209. if WantY < CurY then
  210. local MoveY = CurY-4
  211. if MoveY < WantY then MoveY = WantY end
  212. Msg.Position = UDim2.new(0,0,0,MoveY)
  213. end
  214. end
  215. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement