Advertisement
DesiredMercury

ChatGui

Feb 18th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.84 KB | None | 0 0
  1.  
  2. local CurrentChannel
  3.  
  4. local MainChannel = script.Parent.Frame.MainChannel
  5. local SDChannel = script.Parent.Frame.SDChannel
  6. local MTFChannel = script.Parent.Frame.MTFChannel
  7. local SCDChannel = script.Parent.Frame.SCDChannel
  8. local MDChannel = script.Parent.Frame.MDChannel
  9. local ETChannel = script.Parent.Frame.ETChannel
  10. local ISDChannel = script.Parent.Frame.ISDChannel
  11. local IAChannel = script.Parent.Frame.IAChannel
  12. local ECChannel = script.Parent.Frame.ECChannel
  13. local DEAChannel = script.Parent.Frame.DEAChannel
  14. local ADChannel = script.Parent.Frame.ADChannel
  15. local CDChannel = script.Parent.Frame.CDChannel
  16.  
  17. local TextService = game:GetService("TextService")
  18.  
  19. local ReceivingEvent = game.ReplicatedStorage.ChattedEvent
  20.  
  21. local TextBoxEvent = game.ReplicatedStorage.ChattedEvent
  22.  
  23. local PlayerEvent = game.ReplicatedStorage.PlayerEvent
  24.  
  25. local SendBackEvent = game.ReplicatedStorage.SendBackEvent
  26.  
  27.  
  28. local TextBox = script.Parent.Frame.TextBox
  29. local Contents = TextBox.Text
  30.  
  31. script.Parent.Frame.ChannelSelection.MainChannel.MouseButton1Down:Connect(function()
  32.    CurrentChannel = MainChannel
  33.    MainChannel.Visible = true
  34.    SDChannel.Visible = false
  35.    MTFChannel.Visible = false
  36.    SCDChannel.Visible = false
  37.    MDChannel.Visible = false
  38.    ETChannel.Visible = false
  39.    ISDChannel.Visible = false
  40.    IAChannel.Visible = false
  41.    ECChannel.Visible = false
  42.    DEAChannel.Visible = false
  43.    ADChannel.Visible = false
  44.    CDChannel.Visible = false
  45.  
  46.    script.Parent.Frame.TextLabel.Text = "Current Channel: "..CurrentChannel.Name
  47.  
  48. end)
  49.  
  50. script.Parent.Frame.ChannelSelection.SDChannel.MouseButton1Down:Connect(function()
  51.    CurrentChannel = SDChannel
  52.    MainChannel.Visible = false
  53.    SDChannel.Visible = true
  54.    MTFChannel.Visible = false
  55.    SCDChannel.Visible = false
  56.    MDChannel.Visible = false
  57.    ETChannel.Visible = false
  58.    ISDChannel.Visible = false
  59.    IAChannel.Visible = false
  60.    ECChannel.Visible = false
  61.    DEAChannel.Visible = false
  62.    ADChannel.Visible = false
  63.    CDChannel.Visible = false
  64.  
  65.    script.Parent.Frame.TextLabel.Text = "Current Channel: "..CurrentChannel.Name
  66.  
  67. end)
  68.  
  69.  
  70.  
  71. --[[function DoSomethingWithTheCall(sender, message)
  72.     local Template = game.Players.LocalPlayer.PlayerGui.ChatBox.Frame.ScrollingFrame.TextLabel
  73.     local ClonedTemplate = Template:Clone()
  74.     ClonedTemplate.Text = sender..": "..message
  75.     ClonedTemplate.Parent = Template.Parent
  76.     ClonedTemplate.TextTransparency = 0
  77.     script.Parent.CanvasPosition = script.Parent.CanvasPosition + Vector2.new(0,17)
  78.     script.Parent.CanvasSize= script.Parent.CanvasSize + UDim2.new(0,0, 0,17)  
  79. end--]]
  80.  
  81.  
  82.  
  83. local Mouse = game.Players.LocalPlayer:GetMouse()
  84.  
  85. Mouse.KeyDown:Connect(function(Key)
  86.     if Key:lower() == "/" then
  87.         script.Parent.Frame.TextBox:CaptureFocus()
  88.     end
  89. end)
  90.  
  91.  
  92. function DoSomethingWithTheTextCall(wait)
  93.  
  94.     local playerFrom = game.Players.LocalPlayer
  95.     local Contents = TextBox.Text  
  96.  
  97.     TextBoxEvent:FireServer(Contents)
  98.    
  99. end
  100.  
  101. TextBox.FocusLost:Connect(function()    
  102.    DoSomethingWithTheTextCall()
  103. end)
  104.  
  105.  
  106. if CurrentChannel == nil then
  107.     print("CurrentChannel, Nil Value, Error:1")
  108. else
  109.     print("Channel path found successfully.")  
  110. end
  111.  
  112. SendBackEvent.OnClientEvent:Connect(function(Contents2, SentPlayer)
  113.     local Template = CurrentChannel.TextLabel
  114.     local ClonedTemplate = Template:Clone()
  115.  
  116.         ClonedTemplate.Text = SentPlayer.Name..": "..Contents2        
  117.         ClonedTemplate.Parent = Template.Parent
  118.         ClonedTemplate.TextTransparency = 0
  119.         CurrentChannel.CanvasPosition = CurrentChannel.CanvasPosition + Vector2.new(0,30)
  120.         CurrentChannel.CanvasSize= CurrentChannel.CanvasSize + UDim2.new(0,0, 0,17)
  121. end)
  122.  
  123.  
  124.  
  125.    
  126.  
  127.  
  128.  
  129.  
  130. PlayerEvent:FireServer()
  131.  
  132.  
  133. --ReceivingEvent.OnClientEvent:Connect(DoSomethingWithTheCall)
  134.  
  135.  
  136. game:GetService("StarterGui"):SetCoreGuiEnabled("Chat", false)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement