Guest User

Untitled

a guest
May 22nd, 2020
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 27.20 KB | None | 0 0
  1. I have a plugin that adds all the old ROBLOX GUIs and animations into my game. Issue is that the chat does not send the messages.
  2.  
  3. This is the retromanager script I have in ServerScriptService:
  4.  
  5. ~~~~~~~~~~~~~~~~~
  6. receivechat = workspace:WaitForChild("ReceiveChat")
  7. script:WaitForChild("Settings")
  8. anims = script.Settings:WaitForChild("RetroCharacterAnimations").Value
  9. body = script.Settings:WaitForChild("RetroCharacterBody").Value
  10. sounds = script.Settings:WaitForChild("RetroCharacterSound").Value
  11. face = script.Settings:WaitForChild("RetroCharacterFace").Value
  12. namelog = {}
  13. chatlog = {}
  14. timelog = {}
  15. function trimLeft(s,n)
  16.     return string.sub(s, n+1)
  17. end
  18. function trimRight(s,n)
  19.     return string.sub(s, 1, -n-1)
  20. end
  21. function cropLeft(s,n)
  22.     return string.sub(s, 1, n)
  23. end
  24. function cropRight(s,n)
  25.     return string.sub(s, -n, -1)
  26. end
  27. function receivechat.OnServerInvoke(username, message)
  28.     pcall(function()
  29.         message = game:GetService("Chat"):FilterStringForPlayerAsync(message, username)
  30.     end)
  31.     if cropLeft(message, 1) ~= "%" then
  32.         local players = game:GetService("Players"):GetChildren()
  33.         for i = 1, #players do
  34.             if players[i].ClassName == "Player" then
  35.                 spawn(function()
  36.                     pcall(function()
  37.                         message = game:GetService("Chat"):FilterStringForPlayerAsync(message, players[i])
  38.                     end)
  39.                     players[i]:WaitForChild("PlayerGui"):WaitForChild("Retro"):WaitForChild("LocalScript"):WaitForChild("SendChat"):InvokeClient(players[i],{username.Name,message,0})
  40.                 end)
  41.             end
  42.         end
  43.     else
  44.         local players = game:GetService("Players"):GetChildren()
  45.         for i = 1, #players do
  46.             if players[i].ClassName == "Player" then
  47.                 if players[i].TeamColor == username.TeamColor or players[i].Neutral then
  48.                     spawn(function()
  49.                         pcall(function()
  50.                             message = game:GetService("Chat"):FilterStringForPlayerAsync(message, username)
  51.                         end)
  52.                         players[i]:WaitForChild("PlayerGui"):WaitForChild("Retro"):WaitForChild("LocalScript"):WaitForChild("SendChat"):InvokeClient(players[i],{username.Name,"(TEAM) "..trimLeft(message,1),0})
  53.                     end)
  54.                 end
  55.             end
  56.         end
  57.     end
  58.     namelog[1] = namelog[2]
  59.     namelog[2] = namelog[3]
  60.     namelog[3] = namelog[4]
  61.     namelog[4] = namelog[5]
  62.     namelog[5] = namelog[6]
  63.     namelog[6] = username.Name
  64.     chatlog[1] = chatlog[2]
  65.     chatlog[2] = chatlog[3]
  66.     chatlog[3] = chatlog[4]
  67.     chatlog[4] = chatlog[5]
  68.     chatlog[5] = chatlog[6]
  69.     chatlog[6] = message
  70.     timelog[1] = timelog[2]
  71.     timelog[2] = timelog[3]
  72.     timelog[3] = timelog[4]
  73.     timelog[4] = timelog[5]
  74.     timelog[5] = timelog[6]
  75.     timelog[6] = workspace.DistributedGameTime
  76. end
  77. function makeheadmesh(character)
  78.     if character:IsDescendantOf(game) and character:WaitForChild("Head"):IsDescendantOf(game) then
  79.         script.Mesh:Clone().Parent = character:WaitForChild("Head")
  80.     end
  81. end
  82. function clean(item, character)
  83.     if item.Name == "face" and face then
  84.         item:Destroy()
  85.         local f = script:WaitForChild("face2"):Clone()
  86.         f.Parent = character.Head
  87.     elseif item.ClassName == "CharacterMesh" and body then
  88.         item:Destroy()
  89.     elseif (item.ClassName == "SpecialMesh" or item.ClassName == "BlockMesh" or item.ClassName == "CylinderMesh") and not (item.ClassName == "SpecialMesh" and item.MeshType == Enum.MeshType.Head and item.Scale == Vector3.new(1.25,1.25,1.25)) and body then
  90.         makeheadmesh(character)
  91.     end
  92. end
  93. function pa(player)
  94.     player.CharacterAdded:connect(function(character)
  95.         if anims then
  96.             character:WaitForChild("Animate"):Destroy()
  97.             local a = script:WaitForChild("Animate"):clone()
  98.             a.Parent = character
  99.             a.Disabled = false
  100.         end
  101.         if sounds then
  102.             character:WaitForChild("Sound"):Destroy()
  103.             local s = script:WaitForChild("Sound"):clone()
  104.             s.Parent = character
  105.             s.Disabled = false
  106.         end
  107.         if body then
  108.             character.ChildAdded:connect(function(item)
  109.                 wait()
  110.                 clean(item, character)
  111.             end)
  112.             local get = character:GetChildren()
  113.             for i = 1, #get do
  114.                 clean(get[i], character)
  115.             end
  116.             character:WaitForChild("Head").ChildAdded:connect(function(item)
  117.                 wait()
  118.                 clean(item, character)
  119.             end)
  120.             local get = character.Head:GetChildren()
  121.             for i = 1, #get do
  122.                 clean(get[i], character)
  123.             end
  124.         end
  125.         for i = 1, 6 do
  126.             if namelog[i] and chatlog[i] and timelog[i] and workspace.DistributedGameTime - timelog[i] < 30 then
  127.                 if cropLeft(chatlog[i], 1) ~= "%" then
  128.                     player:WaitForChild("PlayerGui"):WaitForChild("Retro"):WaitForChild("LocalScript"):WaitForChild("SendChat"):InvokeClient(player, {namelog[i], chatlog[i], workspace.DistributedGameTime - timelog[i]})
  129.                 end
  130.             end
  131.         end
  132.     end)
  133. end
  134. game:GetService("Players").PlayerAdded:connect(pa)
  135.  
  136. local get = game:GetService("Players"):GetChildren()
  137. for i = 1, #get do
  138.     pa(get[i])
  139. end
  140. ~~~~~~~~~~~~~~~~~
  141.  
  142. and this is the LocalScript I have in Starter GUI under a ScreenGUI:
  143.  
  144. ~~~~~~~~~~~~~~~~~
  145. for k, v in pairs(workspace.CurrentCamera:GetChildren()) do
  146.     if v.Name == "walkdisc" then
  147.         v:Destroy()
  148.     end
  149. end
  150. localplayer = game:GetService("Players").LocalPlayer
  151. repeat wait() until localplayer.Character
  152. repeat wait() until localplayer.Character:IsDescendantOf(game)
  153. mouse = localplayer:GetMouse()
  154. sendchat = Instance.new("RemoteFunction")
  155. sendchat.Name = "SendChat"
  156. sendchat.Parent = script
  157. gui = script.Parent
  158. walkdisc = script:WaitForChild("walkdisc")
  159. walkdisc.Parent = workspace.CurrentCamera
  160. m = Instance.new("CylinderMesh",walkdisc)
  161. m.Scale = Vector3.new(1,0.4,1)
  162. mouse.TargetFilter = walkdisc
  163. health = gui:WaitForChild("Health")
  164. inventory = gui:WaitForChild("Inventory")
  165. playerlist = gui:WaitForChild("PlayerList")
  166. chat = gui:WaitForChild("Chat")
  167. chatlist = gui:WaitForChild("ChatList")
  168.  
  169. ChatColors = {BrickColor.new("Bright red"),BrickColor.new("Bright blue"),BrickColor.new("Earth green"),BrickColor.new("Bright violet"),BrickColor.new("Bright orange"),BrickColor.new("Bright yellow"),BrickColor.new("Light reddish violet"),BrickColor.new("Brick yellow")}
  170. inv = {"1","2","3","4","5","6","7","8","9","0"}
  171. players = {}
  172. tools = {}
  173. cursel = ""
  174.  
  175. function spairs(t, order)
  176.     local keys = {}
  177.     for k in pairs(t) do keys[#keys+1] = k end
  178.     if order then
  179.         table.sort(keys, function(a,b) return order(t, a, b) end)
  180.     else
  181.         table.sort(keys)
  182.     end
  183.     local i = 0
  184.     return function()
  185.         i = i + 1
  186.         if keys[i] then
  187.             return keys[i], t[keys[i]]
  188.         end
  189.     end
  190. end
  191.  
  192. function GetNameValue(name)
  193.     local value = 0
  194.     for index = 1, #name do
  195.         local cValue = string.byte(string.sub(name, index, index))
  196.         local reverseIndex = #name - index + 1
  197.         if #name % 2 == 1 then
  198.             reverseIndex = reverseIndex - 1        
  199.         end
  200.         if reverseIndex % 4 >= 2 then
  201.             cValue = -cValue           
  202.         end
  203.         value = value + cValue
  204.     end
  205.     return value % 8
  206. end
  207.  
  208. function indexcheck(v)
  209.     for i=1,#tools do
  210.         if tools[i] == v then
  211.             return i
  212.         end
  213.     end
  214.     return false
  215. end
  216.  
  217. function updateplist()
  218.     local fplayers = game:GetService("Players"):GetChildren()
  219.     local fteams = game:GetService("Teams"):GetChildren()
  220.     players = {}
  221.     teams = {}
  222.     local get = playerlist:GetChildren()
  223.     for i=1,#get do
  224.         if not string.find(get[i].Name,"_Label") then
  225.             get[i]:Destroy()
  226.         end
  227.     end
  228.     for i=1,#fplayers do
  229.         if fplayers[i].ClassName == "Player" then
  230.             table.insert(players,#players+1,fplayers[i])
  231.         end
  232.     end
  233.     for i=1,#fteams do
  234.         if fteams[i].ClassName == "Team" then
  235.             table.insert(teams,#teams+1,fteams[i])
  236.         end
  237.     end
  238.     if #teams > 0 then --Player Names
  239.         playerlist:WaitForChild("_Label1").Text = "Team"
  240.         local teamspace = 0
  241.         for i2=1,#teams do
  242.             local labelt = script.Team:Clone()
  243.             labelt:WaitForChild("_Label2").Text = teams[i2].Name
  244.             labelt:WaitForChild("_Label2").TextColor3 = teams[i2].TeamColor.Color
  245.             labelt:WaitForChild("_Label3").BackgroundColor3 = teams[i2].TeamColor.Color
  246.             local vplayers = {}
  247.             for i=1,#players do
  248.                 if not players[i].Neutral and players[i].TeamColor == teams[i2].TeamColor then
  249.                     table.insert(vplayers,#vplayers+1,players[i])
  250.                 end
  251.             end
  252.             for i=1,#vplayers do
  253.                 local label = script:WaitForChild("Player"):Clone()
  254.                 label.Text = vplayers[i].Name
  255.                 label.Position = UDim2.new(0,0,0,30+(20*(i-1)))
  256.                 label.Parent = labelt
  257.                 label.TextColor3 = vplayers[i].TeamColor.Color
  258.             end
  259.             labelt.Position = UDim2.new(0,5,0,20+teamspace)
  260.             labelt.Size = UDim2.new(1,0,0,40+(20*#vplayers))
  261.             teamspace = teamspace + labelt.Size.Y.Offset
  262.             labelt.Parent = playerlist
  263.         end
  264.         playerlist.Size = UDim2.new(0,168,0,40+teamspace)
  265.     else
  266.         for i=1,#players do
  267.             local label = script:WaitForChild("Player"):Clone()
  268.             label.Text = fplayers[i].Name
  269.             label.Position = UDim2.new(0,0,0,40+(20*(i-1)))
  270.             label.Parent = playerlist
  271.             label.TextColor3 = ChatColors[GetNameValue(fplayers[i].Name) + 1].Color
  272.         end
  273.         playerlist.Size = UDim2.new(0,168,0,40+(20*#players))
  274.     end
  275.     local lslabels = {} --Player Scores
  276.     for i=1,#players do
  277.         if players[i]:FindFirstChild("leaderstats") then
  278.             local get = players[i].leaderstats:GetChildren()
  279.             for i2=1,#get do
  280.                 if get[i2].ClassName == "IntValue" or get[i2].ClassName == "NumberValue" then
  281.                     local ret = false
  282.                     for i3=1,#lslabels do
  283.                         if lslabels[i3].Name == get[i2].Name then
  284.                             ret = true
  285.                         end
  286.                     end
  287.                     if ret == false then
  288.                         table.insert(lslabels,#lslabels+1,get[i2])
  289.                     end
  290.                     for i3=1,#lslabels do
  291.                         if lslabels[i3].Name == get[i2].Name then
  292.                             local nslabel = script:WaitForChild("ScoreLabel"):Clone()
  293.                             nslabel.Text = tostring(get[i2].Value)
  294.                             if i3 == 1 then
  295.                                 nslabel.Position = UDim2.new(0,155,0,0)
  296.                             else
  297.                                 nslabel.Position = UDim2.new(0,155+(80/(i3-1)),0,0)
  298.                             end
  299.                             local get2 = playerlist:GetChildren()
  300.                             for i4=1,#get2 do
  301.                                 if get2[i4].Name == "Team" then
  302.                                     local get3 = get2[i4]:GetChildren()
  303.                                     for i5=1,#get3 do
  304.                                         if get3[i5].Name == "Player" and get3[i5].Text == players[i].Name then
  305.                                             nslabel.TextColor3 = get3[i5].TextColor3
  306.                                             nslabel.Parent = get3[i5]
  307.                                         end
  308.                                     end
  309.                                 elseif get2[i4].Name == "Player" and get2[i4].Text == players[i].Name then
  310.                                     nslabel.Parent = get2[i4]
  311.                                 end
  312.                             end
  313.                         end
  314.                     end
  315.                 end
  316.             end
  317.         end
  318.     end
  319.     local get = playerlist:GetChildren() --Team Scores
  320.     if #teams > 0 then
  321.         for i=1,#get do
  322.             if get[i].Name == "Team" then
  323.                 local valtable = {}
  324.                 local get2 = get[i]:GetChildren()
  325.                 for i2=1,#get2 do
  326.                     if get2[i2].Name == "Player" then
  327.                         local get3 = get2[i2]:GetChildren()
  328.                         for i3=1,#get3 do
  329.                             if valtable[i3] then
  330.                                 valtable[i3] = valtable[i3] + tonumber(get3[i3].Text)
  331.                             else
  332.                                 valtable[i3] = tonumber(get3[i3].Text)
  333.                             end
  334.                         end
  335.                     end
  336.                 end
  337.                 for i2=1,#valtable do
  338.                     local nslabel = script:WaitForChild("ScoreLabel"):Clone()
  339.                     nslabel.Text = tostring(valtable[i2])
  340.                     if i2 == 1 then
  341.                         nslabel.Position = UDim2.new(0,155,0,0)
  342.                     else
  343.                         nslabel.Position = UDim2.new(0,155+(80/(i2-1)),0,0)
  344.                     end
  345.                     nslabel.TextColor3 = get[i]:FindFirstChild("_Label2").TextColor3
  346.                     nslabel.TextStrokeTransparency = 0.5
  347.                     nslabel.Parent = get[i]
  348.                 end
  349.             end
  350.         end
  351.     end
  352.     local function sorter(tosort) --Sorting
  353.         local sorted = {}
  354.         local get2 = tosort:GetChildren()
  355.         for i=1,#get2 do
  356.             if get2[i].Name == "Player" then
  357.                 if get2[i]:FindFirstChild("ScoreLabel") then
  358.                     sorted[get2[i]] = tonumber(get2[i]:FindFirstChild("ScoreLabel").Text)
  359.                 else
  360.                     sorted[get2[i]] = -math.huge
  361.                 end
  362.             end
  363.         end
  364.         local i = 0
  365.         for k,v in spairs(sorted, function(t,a,b) return t[b] < t[a] end) do
  366.             i = i + 1
  367.             k.Position = UDim2.new(0,0,0,30+(20*(i-1)))
  368.         end
  369.     end
  370.     if #teams > 0 then
  371.         for i=1,#get do
  372.             if get[i].Name == "Team" then
  373.                 sorter(get[i])
  374.             end
  375.         end
  376.     else
  377.         sorter(playerlist)
  378.     end
  379.     if #lslabels > 0 then --Titles
  380.         playerlist.Position = UDim2.new(1,-330,0,10)
  381.         playerlist.Size = UDim2.new(playerlist.Size.X,320,playerlist.Size.Y,playerlist.Size.Y.Offset)
  382.         for i=1,#lslabels do
  383.             local nslabel = script:WaitForChild("LSLabel"):Clone()
  384.             nslabel.Text = lslabels[i].Name
  385.             if i == 1 then
  386.                 nslabel.Position = UDim2.new(0,160,0,0)
  387.             else
  388.                 nslabel.Position = UDim2.new(0,160+(80/(i-1)),0,0)
  389.             end
  390.             nslabel.Parent = playerlist
  391.         end
  392.     elseif #teams > 0 then
  393.         playerlist:WaitForChild("_Label1").Text = ""
  394.         for i=1,#get do
  395.             if get[i].Name == "Team" then
  396.                 get[i].Position = UDim2.new(get[i].Position.X,get[i].Position.X.Offset,get[i].Position.Y,get[i].Position.Y.Offset-20)
  397.             end
  398.         end
  399.         playerlist.Size = UDim2.new(playerlist.Size.X,playerlist.Size.X.Offset,playerlist.Size.Y,playerlist.Size.Y.Offset-20)
  400.     end
  401. end
  402.  
  403. function updatetlist()
  404.     local f1 = localplayer.Character:GetChildren()
  405.     local f2 = localplayer.Backpack:GetChildren()
  406.     local get = inventory:GetChildren()
  407.     for i=1,#get do
  408.         get[i].Visible = false
  409.     end
  410.     for i=1,#f1 do
  411.         if f1[i].ClassName == "Tool" and indexcheck(f1[i]) == false then
  412.             table.insert(tools,#tools+1,f1[i])
  413.         end
  414.     end
  415.     for i=1,#f2 do
  416.         if f2[i].ClassName == "Tool" and indexcheck(f2[i]) == false then
  417.             table.insert(tools,#tools+1,f2[i])
  418.         end
  419.     end
  420.     for i=1,#tools do
  421.         if i >= 1 and i <= 10 then
  422.             local ret = inv[i]
  423.             if tools[i].TextureId ~= "" then
  424.                 inventory["Slot"..ret].ImageLabel.Image = tools[i].TextureId
  425.                 inventory["Slot"..ret].Text = ""
  426.             else
  427.                 inventory["Slot"..ret].ImageLabel.Image = ""
  428.                 inventory["Slot"..ret].Text = "  " .. tools[i].Name
  429.             end
  430.             inventory["Slot"..ret].Visible = true
  431.         end
  432.     end
  433. end
  434.  
  435. function updateclist()
  436.     local chats = chatlist:GetChildren()
  437.     for i=1,#chats do
  438.         chats[i].Position = UDim2.new(0,0,0,(i*14)-14)
  439.     end
  440. end
  441.  
  442. function createchat(text)
  443.     workspace.ReceiveChat:InvokeServer(text)
  444. end
  445.  
  446. function activatetool(number)
  447.     local get = localplayer.Character:GetChildren()
  448.     for i=1,#get do
  449.         if get[i].ClassName == "Tool" then
  450.             get[i].Parent = localplayer.Backpack
  451.         end
  452.     end
  453.     if cursel ~= number then
  454.         cursel = number
  455.         inventory["Slot1"].BorderSizePixel = 0
  456.         inventory["Slot2"].BorderSizePixel = 0
  457.         inventory["Slot3"].BorderSizePixel = 0
  458.         inventory["Slot4"].BorderSizePixel = 0
  459.         inventory["Slot5"].BorderSizePixel = 0
  460.         inventory["Slot6"].BorderSizePixel = 0
  461.         inventory["Slot7"].BorderSizePixel = 0
  462.         inventory["Slot8"].BorderSizePixel = 0
  463.         inventory["Slot9"].BorderSizePixel = 0
  464.         inventory["Slot0"].BorderSizePixel = 0
  465.         if tonumber(cursel) <= 10 then
  466.             local ret = inv[tonumber(cursel)]
  467.             inventory["Slot"..ret].BorderSizePixel = 1
  468.         end
  469.         local select = tools[tonumber(number)]
  470.         if select then
  471.             select.Parent = localplayer.Character
  472.         end
  473.     else
  474.         cursel = ""
  475.         inventory["Slot1"].BorderSizePixel = 0
  476.         inventory["Slot2"].BorderSizePixel = 0
  477.         inventory["Slot3"].BorderSizePixel = 0
  478.         inventory["Slot4"].BorderSizePixel = 0
  479.         inventory["Slot5"].BorderSizePixel = 0
  480.         inventory["Slot6"].BorderSizePixel = 0
  481.         inventory["Slot7"].BorderSizePixel = 0
  482.         inventory["Slot8"].BorderSizePixel = 0
  483.         inventory["Slot9"].BorderSizePixel = 0
  484.         inventory["Slot0"].BorderSizePixel = 0
  485.     end
  486. end
  487.  
  488. function sendchat.OnClientInvoke(tuple)
  489.     local username = tuple[1]
  490.     local message = tuple[2]
  491.     local timeout = tuple[3]
  492.     if game:GetService("Players"):FindFirstChild(username) then
  493.         local newchat = script.Chat:Clone()
  494.         newchat.Parent = script
  495.         newchat.Message.Text = " " .. message
  496.         newchat.Username.Text = username .. ":"
  497.         local wid1 = newchat.Message.TextBounds.X
  498.         local wid2 = newchat.Username.TextBounds.X
  499.         local wid3 = wid1 + wid2
  500.         newchat.Message.Size = UDim2.new(0,wid1,0,14)
  501.         newchat.Message.Position = UDim2.new(0,wid2,0,0)
  502.         newchat.Username.Size = UDim2.new(0,wid2,0,14)
  503.         newchat.Size = UDim2.new(0,wid3,0,16)
  504.         if game:GetService("Players"):FindFirstChild(username).Neutral then
  505.             newchat.Username.TextColor3 = ChatColors[GetNameValue(username) + 1].Color
  506.         else
  507.             newchat.Username.TextColor3 = game:GetService("Players"):FindFirstChild(username).TeamColor.Color
  508.         end
  509.         local chats = chatlist:GetChildren()
  510.         if #chats == 6 then
  511.             chats[1]:Destroy()
  512.         end
  513.         newchat.Parent = chatlist
  514.         delay(30-timeout,function()
  515.             if newchat then
  516.                 newchat:Destroy()
  517.             end
  518.         end)
  519.     end
  520. end
  521.  
  522. chat.FocusLost:connect(function(enterPressed)
  523.     if enterPressed then
  524.         local text = chat.Text
  525.         chat.ClearTextOnFocus = true
  526.         chat.BackgroundColor3 = Color3.new(64/255,64/255,64/255)
  527.         chat.Filler.BackgroundColor3 = Color3.new(64/255,64/255,64/255)
  528.         chat.TextColor3 = Color3.new(1,1,200/255)
  529.         chat.Text = 'To chat click here or press the "/" key'
  530.         if string.len(text) ~= 0 then
  531.             createchat(text)
  532.         end
  533.     elseif string.len(chat.Text) == 0 then
  534.         chat.ClearTextOnFocus = true
  535.         chat.BackgroundColor3 = Color3.new(64/255,64/255,64/255)
  536.         chat.Filler.BackgroundColor3 = Color3.new(64/255,64/255,64/255)
  537.         chat.TextColor3 = Color3.new(1,1,200/255)
  538.         chat.Text = 'To chat click here or press the "/" key'
  539.     else
  540.         chat.BackgroundColor3 = Color3.new(64/255,64/255,64/255)
  541.         chat.Filler.BackgroundColor3 = Color3.new(64/255,64/255,64/255)
  542.         chat.TextColor3 = Color3.new(1,1,1)
  543.     end
  544. end)
  545. chat:WaitForChild("ClickDetect").MouseButton1Click:connect(function()
  546.     chat:CaptureFocus()
  547.     chat.ClearTextOnFocus = false
  548.     chat.BackgroundColor3 = Color3.new(1,1,1)
  549.     chat.Filler.BackgroundColor3 = Color3.new(1,1,1)
  550.     chat.TextColor3 = Color3.new(0,0,0)
  551. end)
  552. game:GetService("UserInputService").InputBegan:connect(function(key, gameProcessedEvent)
  553.     local caller, error = pcall(function()
  554.         key = key.KeyCode
  555.     end)
  556.     if not key or not caller or chat.TextColor3 == Color3.new(0,0,0) then
  557.         return
  558.     end
  559.     if key == Enum.KeyCode.One then
  560.         activatetool("1")
  561.     elseif key == Enum.KeyCode.Two then
  562.         activatetool("2")
  563.     elseif key == Enum.KeyCode.Three then
  564.         activatetool("3")
  565.     elseif key == Enum.KeyCode.Four then
  566.         activatetool("4")
  567.     elseif key == Enum.KeyCode.Five then
  568.         activatetool("5")
  569.     elseif key == Enum.KeyCode.Six then
  570.         activatetool("6")
  571.     elseif key == Enum.KeyCode.Seven then
  572.         activatetool("7")
  573.     elseif key == Enum.KeyCode.Eight then
  574.         activatetool("8")
  575.     elseif key == Enum.KeyCode.Nine then
  576.         activatetool("9")
  577.     elseif key == Enum.KeyCode.Zero then
  578.         activatetool("10")
  579.     elseif key == Enum.KeyCode.Slash then
  580.         chat:CaptureFocus()
  581.         chat.ClearTextOnFocus = false
  582.         chat.BackgroundColor3 = Color3.new(1,1,1)
  583.         chat.Filler.BackgroundColor3 = Color3.new(1,1,1)
  584.         chat.TextColor3 = Color3.new(0,0,0)
  585.     elseif (key == Enum.KeyCode.I or key == Enum.KeyCode.O or key == Enum.KeyCode.Comma or key == Enum.KeyCode.Period) and chat.TextColor3 ~= Color3.new(0,0,0) then
  586.         local s = script.SWITCH3:Clone()
  587.         s.Parent = script
  588.         s:Play()
  589.         s:Destroy()
  590.     elseif key == Enum.KeyCode.W or key == Enum.KeyCode.A or key == Enum.KeyCode.S or key == Enum.KeyCode.D or key == Enum.KeyCode.Up or key == Enum.KeyCode.Down then
  591.         for k, v in pairs(walkdisc:GetChildren()) do
  592.             if v.Name == "walkdisc" then
  593.                 v.Parent = nil
  594.             end
  595.         end
  596.     end
  597. end)
  598. mouse.WheelForward:connect(function()
  599.     local s = script.SWITCH3:Clone()
  600.     s.Parent = script
  601.     s:Play()
  602.     s:Destroy()
  603. end)
  604. mouse.WheelBackward:connect(function()
  605.     local s = script.SWITCH3:Clone()
  606.     s.Parent = script
  607.     s:Play()
  608.     s:Destroy()
  609. end)
  610. mouse.Button1Down:connect(function()
  611.     if walkdisc.Transparency == 0 and localplayer:DistanceFromCharacter(mouse.Hit.p) <= 50 then
  612.         for k, v in pairs(walkdisc:GetChildren()) do
  613.             if v.Name == "walkdisc" then
  614.                 v.Parent = nil
  615.             end
  616.         end
  617.         local newwalk = walkdisc:Clone()
  618.         newwalk.Parent = walkdisc
  619.         while newwalk and localplayer.Character and localplayer.Character:FindFirstChild("Humanoid") and newwalk:IsDescendantOf(walkdisc) and localplayer:DistanceFromCharacter(newwalk.Position) > 5 do
  620.             localplayer.Character.Humanoid:MoveTo(newwalk.Position, newwalk)
  621.             wait()
  622.         end
  623.         newwalk:Destroy()
  624.     end
  625. end)
  626. function leaderstatsconnectors(player)
  627.     local children = player:GetChildren() --Connect Existing Leaderstats
  628.     for i=1,#children do
  629.         if children[i].Name == "leaderstats" then
  630.             local children2 = children[i]:GetChildren()
  631.             for i2=1,#children2 do
  632.                 if children2[i2].ClassName == "IntValue" or children2[i2].ClassName == "NumberValue" then
  633.                     children2[i2].Changed:connect(updateplist)
  634.                 end
  635.             end
  636.             children[i].ChildAdded:connect(function(child2)
  637.                 if child2.ClassName == "IntValue" or child2.ClassName == "NumberValue" then
  638.                     child2.Changed:connect(updateplist)
  639.                     updateplist()
  640.                 end
  641.             end)
  642.             children[i].ChildRemoved:connect(updateplist)
  643.             updateplist()
  644.         end
  645.     end
  646.     player.ChildAdded:connect(function(child) --Connect New Leaderstats
  647.         if child.Name == "leaderstats" then
  648.             local children2 = child:GetChildren()
  649.             for i2=1,#children2 do
  650.                 if children2[i2].ClassName == "IntValue" or children2[i2].ClassName == "NumberValue" then
  651.                     children2[i2].Changed:connect(function()
  652.                         updateplist()
  653.                     end)
  654.                 end
  655.             end
  656.             child.ChildAdded:connect(function(child2)
  657.                 if child2.ClassName == "IntValue" or child2.ClassName == "NumberValue" then
  658.                     child2.Changed:connect(updateplist)
  659.                     updateplist()
  660.                 end
  661.             end)
  662.             child.ChildRemoved:connect(updateplist)
  663.             updateplist()
  664.         end
  665.     end)
  666.     player.ChildRemoved:connect(function(child) --Connect Removing Leaderstats
  667.         if child.Name == "leaderstats" then
  668.             updateplist()
  669.         end
  670.     end)
  671. end
  672. players = game:GetService("Players"):GetChildren() --Connect Existing Players
  673. for i=1,#players do
  674.     if players[i].ClassName == "Player" then
  675.         players[i].Changed:connect(updateplist)
  676.         leaderstatsconnectors(players[i])
  677.     end
  678. end
  679. game:GetService("Players").ChildAdded:connect(function(player) --Connect New Players
  680.     if player.ClassName == "Player" then
  681.         player.Changed:connect(updateplist)
  682.         leaderstatsconnectors(player)
  683.         updateplist()
  684.     end
  685. end)
  686. game:GetService("Players").ChildRemoved:connect(function(player) --Connect Removing Players
  687.     if player.ClassName == "Player" then
  688.         updateplist()
  689.     end
  690. end)
  691. teams = game:GetService("Teams"):GetChildren() --Connect Existing Teams
  692. for i=1,#teams do
  693.     if teams[i].ClassName == "Team" then
  694.         teams[i].Changed:connect(updateplist)
  695.     end
  696. end
  697. game:GetService("Teams").ChildAdded:connect(function(team) --Connect New Teams
  698.     if team.ClassName == "Team" then
  699.         team.Changed:connect(updateplist)
  700.         updateplist()
  701.     end
  702. end)
  703. game:GetService("Teams").ChildRemoved:connect(function(team) --Connect Removing Teams
  704.     if team.ClassName == "Team" then
  705.         updateplist()
  706.     end
  707. end)
  708. updateplist() --Player Update
  709. localplayer.Backpack.ChildAdded:connect(function(tool) --Connect New Tools
  710.     if tool.ClassName == "Tool" then
  711.         if indexcheck(tool) == false then
  712.             tool.Changed:connect(updatetlist)
  713.         end
  714.         updatetlist()
  715.     end
  716. end)
  717. localplayer.Backpack.ChildRemoved:connect(function(tool) --Connect Removing Tools
  718.     if tool.ClassName == "Tool" then
  719.         if tool.Parent == localplayer.Character then
  720.             updatetlist()
  721.         else
  722.             table.remove(tools,indexcheck(tool))
  723.             updatetlist()
  724.         end
  725.     end
  726. end)
  727. localplayer.Character.ChildAdded:connect(function(tool) --Connect New Tools By Character
  728.     if tool.ClassName == "Tool" then
  729.         local doac = false
  730.         if indexcheck(tool) == false then
  731.             doac = true
  732.             tool.Changed:connect(updatetlist)
  733.         end
  734.         updatetlist()
  735.         if doac == true then
  736.             cursel = tostring(indexcheck(tool))
  737.             inventory["Slot1"].BorderSizePixel = 0
  738.             inventory["Slot2"].BorderSizePixel = 0
  739.             inventory["Slot3"].BorderSizePixel = 0
  740.             inventory["Slot4"].BorderSizePixel = 0
  741.             inventory["Slot5"].BorderSizePixel = 0
  742.             inventory["Slot6"].BorderSizePixel = 0
  743.             inventory["Slot7"].BorderSizePixel = 0
  744.             inventory["Slot8"].BorderSizePixel = 0
  745.             inventory["Slot9"].BorderSizePixel = 0
  746.             inventory["Slot0"].BorderSizePixel = 0
  747.             if tonumber(cursel) <= 10 then
  748.                 inventory["Slot"..inv[tonumber(cursel)]].BorderSizePixel = 1
  749.             end
  750.         end
  751.     end
  752. end)
  753. localplayer.Character.ChildRemoved:connect(function(tool) --Connect Removing Tools By Character
  754.     if tool.ClassName == "Tool" then
  755.         if tool.Parent == localplayer.Backpack then
  756.             updatetlist()
  757.             if indexcheck(tool) and cursel == tostring(indexcheck(tool)) and not tool.CanBeDropped then
  758.                 wait()
  759.                 if cursel == tostring(indexcheck(tool)) then
  760.                     cursel = ""
  761.                     inventory["Slot1"].BorderSizePixel = 0
  762.                     inventory["Slot2"].BorderSizePixel = 0
  763.                     inventory["Slot3"].BorderSizePixel = 0
  764.                     inventory["Slot4"].BorderSizePixel = 0
  765.                     inventory["Slot5"].BorderSizePixel = 0
  766.                     inventory["Slot6"].BorderSizePixel = 0
  767.                     inventory["Slot7"].BorderSizePixel = 0
  768.                     inventory["Slot8"].BorderSizePixel = 0
  769.                     inventory["Slot9"].BorderSizePixel = 0
  770.                     inventory["Slot0"].BorderSizePixel = 0
  771.                 end
  772.             end
  773.         else
  774.             table.remove(tools,indexcheck(tool))
  775.             updatetlist()
  776.             cursel = ""
  777.             inventory["Slot1"].BorderSizePixel = 0
  778.             inventory["Slot2"].BorderSizePixel = 0
  779.             inventory["Slot3"].BorderSizePixel = 0
  780.             inventory["Slot4"].BorderSizePixel = 0
  781.             inventory["Slot5"].BorderSizePixel = 0
  782.             inventory["Slot6"].BorderSizePixel = 0
  783.             inventory["Slot7"].BorderSizePixel = 0
  784.             inventory["Slot8"].BorderSizePixel = 0
  785.             inventory["Slot9"].BorderSizePixel = 0
  786.             inventory["Slot0"].BorderSizePixel = 0
  787.         end
  788.     end
  789. end)
  790. buttons = inventory:GetChildren() --Connect Inventory Click Selection
  791. for i=1,#buttons do
  792.     buttons[i].Button.MouseButton1Click:connect(function()
  793.         if buttons[i].NumberLabel.Text == "0" then
  794.             activatetool("10")
  795.         else
  796.             activatetool(buttons[i].NumberLabel.Text)
  797.         end
  798.     end)
  799. end
  800. updatetlist() --Tool Update
  801. chatlist.ChildAdded:connect(updateclist) --Connect Chat
  802. chatlist.ChildRemoved:connect(updateclist)
  803. function updateHealth(property) --Connect Health
  804.     percentage = localplayer.Character.Humanoid.Health / localplayer.Character.Humanoid.MaxHealth
  805.     if percentage < 0 then
  806.         percentage = 0
  807.     elseif percentage > 1 then
  808.         percentage = 1
  809.     end
  810.     health:WaitForChild("Score").Position = UDim2.new(0,0,1-percentage,0)
  811.     health:WaitForChild("Score").Size = UDim2.new(1,0,percentage,0)
  812. end
  813. localplayer.Character:WaitForChild("Humanoid").Changed:connect(updateHealth)
  814. localplayer.Character.Humanoid.Died:connect(function() updateHealth("Health") end)
  815. game:GetService("RunService").RenderStepped:connect(function()
  816.     if cursel ~= "" then
  817.         game:GetService("UserInputService").MouseIconEnabled = true
  818.         gui.Cursor.Visible = false
  819.     else
  820.         game:GetService("UserInputService").MouseIconEnabled = false
  821.         gui.Cursor.Visible = true
  822.     end
  823.     if gui.Cursor.Visible then
  824.         gui.Cursor.Position = UDim2.new(0, mouse.X - 40, 0, mouse.Y - 40)
  825.         if mouse.Target then
  826.             gui.Cursor.Image = "rbxassetid://199228706"
  827.             for k, v in pairs(mouse.Target:GetChildren()) do
  828.                 if v.ClassName == "ClickDetector" and localplayer:DistanceFromCharacter(mouse.Hit.p) <= v.MaxActivationDistance then
  829.                     gui.Cursor.Image = "rbxassetid://199232395"
  830.                 end
  831.             end
  832.             if localplayer:DistanceFromCharacter(mouse.Hit.p) <= 50 then
  833.                 walkdisc.CFrame = CFrame.new(mouse.Hit.p)
  834.                 walkdisc.Transparency = 0
  835.             else
  836.                 walkdisc.Transparency = 1
  837.             end
  838.         else
  839.             gui.Cursor.Image = "rbxassetid://199228762"
  840.             walkdisc.Transparency = 1
  841.         end
  842.     else
  843.         walkdisc.Transparency = 1
  844.     end
  845. end)
  846. game:GetService("UserInputService").MouseIconEnabled = false
  847. game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
  848. ~~~~~~~~~~~~~~~~~
  849.  
  850. How can I fix this chat to send messages, similar to old ROBLOX? If that can't be sorted, what must I do to return the normal chat?
Advertisement
Add Comment
Please, Sign In to add comment