Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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.
- This is the retromanager script I have in ServerScriptService:
- ~~~~~~~~~~~~~~~~~
- receivechat = workspace:WaitForChild("ReceiveChat")
- script:WaitForChild("Settings")
- anims = script.Settings:WaitForChild("RetroCharacterAnimations").Value
- body = script.Settings:WaitForChild("RetroCharacterBody").Value
- sounds = script.Settings:WaitForChild("RetroCharacterSound").Value
- face = script.Settings:WaitForChild("RetroCharacterFace").Value
- namelog = {}
- chatlog = {}
- timelog = {}
- function trimLeft(s,n)
- return string.sub(s, n+1)
- end
- function trimRight(s,n)
- return string.sub(s, 1, -n-1)
- end
- function cropLeft(s,n)
- return string.sub(s, 1, n)
- end
- function cropRight(s,n)
- return string.sub(s, -n, -1)
- end
- function receivechat.OnServerInvoke(username, message)
- pcall(function()
- message = game:GetService("Chat"):FilterStringForPlayerAsync(message, username)
- end)
- if cropLeft(message, 1) ~= "%" then
- local players = game:GetService("Players"):GetChildren()
- for i = 1, #players do
- if players[i].ClassName == "Player" then
- spawn(function()
- pcall(function()
- message = game:GetService("Chat"):FilterStringForPlayerAsync(message, players[i])
- end)
- players[i]:WaitForChild("PlayerGui"):WaitForChild("Retro"):WaitForChild("LocalScript"):WaitForChild("SendChat"):InvokeClient(players[i],{username.Name,message,0})
- end)
- end
- end
- else
- local players = game:GetService("Players"):GetChildren()
- for i = 1, #players do
- if players[i].ClassName == "Player" then
- if players[i].TeamColor == username.TeamColor or players[i].Neutral then
- spawn(function()
- pcall(function()
- message = game:GetService("Chat"):FilterStringForPlayerAsync(message, username)
- end)
- players[i]:WaitForChild("PlayerGui"):WaitForChild("Retro"):WaitForChild("LocalScript"):WaitForChild("SendChat"):InvokeClient(players[i],{username.Name,"(TEAM) "..trimLeft(message,1),0})
- end)
- end
- end
- end
- end
- namelog[1] = namelog[2]
- namelog[2] = namelog[3]
- namelog[3] = namelog[4]
- namelog[4] = namelog[5]
- namelog[5] = namelog[6]
- namelog[6] = username.Name
- chatlog[1] = chatlog[2]
- chatlog[2] = chatlog[3]
- chatlog[3] = chatlog[4]
- chatlog[4] = chatlog[5]
- chatlog[5] = chatlog[6]
- chatlog[6] = message
- timelog[1] = timelog[2]
- timelog[2] = timelog[3]
- timelog[3] = timelog[4]
- timelog[4] = timelog[5]
- timelog[5] = timelog[6]
- timelog[6] = workspace.DistributedGameTime
- end
- function makeheadmesh(character)
- if character:IsDescendantOf(game) and character:WaitForChild("Head"):IsDescendantOf(game) then
- script.Mesh:Clone().Parent = character:WaitForChild("Head")
- end
- end
- function clean(item, character)
- if item.Name == "face" and face then
- item:Destroy()
- local f = script:WaitForChild("face2"):Clone()
- f.Parent = character.Head
- elseif item.ClassName == "CharacterMesh" and body then
- item:Destroy()
- 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
- makeheadmesh(character)
- end
- end
- function pa(player)
- player.CharacterAdded:connect(function(character)
- if anims then
- character:WaitForChild("Animate"):Destroy()
- local a = script:WaitForChild("Animate"):clone()
- a.Parent = character
- a.Disabled = false
- end
- if sounds then
- character:WaitForChild("Sound"):Destroy()
- local s = script:WaitForChild("Sound"):clone()
- s.Parent = character
- s.Disabled = false
- end
- if body then
- character.ChildAdded:connect(function(item)
- wait()
- clean(item, character)
- end)
- local get = character:GetChildren()
- for i = 1, #get do
- clean(get[i], character)
- end
- character:WaitForChild("Head").ChildAdded:connect(function(item)
- wait()
- clean(item, character)
- end)
- local get = character.Head:GetChildren()
- for i = 1, #get do
- clean(get[i], character)
- end
- end
- for i = 1, 6 do
- if namelog[i] and chatlog[i] and timelog[i] and workspace.DistributedGameTime - timelog[i] < 30 then
- if cropLeft(chatlog[i], 1) ~= "%" then
- player:WaitForChild("PlayerGui"):WaitForChild("Retro"):WaitForChild("LocalScript"):WaitForChild("SendChat"):InvokeClient(player, {namelog[i], chatlog[i], workspace.DistributedGameTime - timelog[i]})
- end
- end
- end
- end)
- end
- game:GetService("Players").PlayerAdded:connect(pa)
- local get = game:GetService("Players"):GetChildren()
- for i = 1, #get do
- pa(get[i])
- end
- ~~~~~~~~~~~~~~~~~
- and this is the LocalScript I have in Starter GUI under a ScreenGUI:
- ~~~~~~~~~~~~~~~~~
- for k, v in pairs(workspace.CurrentCamera:GetChildren()) do
- if v.Name == "walkdisc" then
- v:Destroy()
- end
- end
- localplayer = game:GetService("Players").LocalPlayer
- repeat wait() until localplayer.Character
- repeat wait() until localplayer.Character:IsDescendantOf(game)
- mouse = localplayer:GetMouse()
- sendchat = Instance.new("RemoteFunction")
- sendchat.Name = "SendChat"
- sendchat.Parent = script
- gui = script.Parent
- walkdisc = script:WaitForChild("walkdisc")
- walkdisc.Parent = workspace.CurrentCamera
- m = Instance.new("CylinderMesh",walkdisc)
- m.Scale = Vector3.new(1,0.4,1)
- mouse.TargetFilter = walkdisc
- health = gui:WaitForChild("Health")
- inventory = gui:WaitForChild("Inventory")
- playerlist = gui:WaitForChild("PlayerList")
- chat = gui:WaitForChild("Chat")
- chatlist = gui:WaitForChild("ChatList")
- 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")}
- inv = {"1","2","3","4","5","6","7","8","9","0"}
- players = {}
- tools = {}
- cursel = ""
- function spairs(t, order)
- local keys = {}
- for k in pairs(t) do keys[#keys+1] = k end
- if order then
- table.sort(keys, function(a,b) return order(t, a, b) end)
- else
- table.sort(keys)
- end
- local i = 0
- return function()
- i = i + 1
- if keys[i] then
- return keys[i], t[keys[i]]
- end
- end
- end
- function GetNameValue(name)
- local value = 0
- for index = 1, #name do
- local cValue = string.byte(string.sub(name, index, index))
- local reverseIndex = #name - index + 1
- if #name % 2 == 1 then
- reverseIndex = reverseIndex - 1
- end
- if reverseIndex % 4 >= 2 then
- cValue = -cValue
- end
- value = value + cValue
- end
- return value % 8
- end
- function indexcheck(v)
- for i=1,#tools do
- if tools[i] == v then
- return i
- end
- end
- return false
- end
- function updateplist()
- local fplayers = game:GetService("Players"):GetChildren()
- local fteams = game:GetService("Teams"):GetChildren()
- players = {}
- teams = {}
- local get = playerlist:GetChildren()
- for i=1,#get do
- if not string.find(get[i].Name,"_Label") then
- get[i]:Destroy()
- end
- end
- for i=1,#fplayers do
- if fplayers[i].ClassName == "Player" then
- table.insert(players,#players+1,fplayers[i])
- end
- end
- for i=1,#fteams do
- if fteams[i].ClassName == "Team" then
- table.insert(teams,#teams+1,fteams[i])
- end
- end
- if #teams > 0 then --Player Names
- playerlist:WaitForChild("_Label1").Text = "Team"
- local teamspace = 0
- for i2=1,#teams do
- local labelt = script.Team:Clone()
- labelt:WaitForChild("_Label2").Text = teams[i2].Name
- labelt:WaitForChild("_Label2").TextColor3 = teams[i2].TeamColor.Color
- labelt:WaitForChild("_Label3").BackgroundColor3 = teams[i2].TeamColor.Color
- local vplayers = {}
- for i=1,#players do
- if not players[i].Neutral and players[i].TeamColor == teams[i2].TeamColor then
- table.insert(vplayers,#vplayers+1,players[i])
- end
- end
- for i=1,#vplayers do
- local label = script:WaitForChild("Player"):Clone()
- label.Text = vplayers[i].Name
- label.Position = UDim2.new(0,0,0,30+(20*(i-1)))
- label.Parent = labelt
- label.TextColor3 = vplayers[i].TeamColor.Color
- end
- labelt.Position = UDim2.new(0,5,0,20+teamspace)
- labelt.Size = UDim2.new(1,0,0,40+(20*#vplayers))
- teamspace = teamspace + labelt.Size.Y.Offset
- labelt.Parent = playerlist
- end
- playerlist.Size = UDim2.new(0,168,0,40+teamspace)
- else
- for i=1,#players do
- local label = script:WaitForChild("Player"):Clone()
- label.Text = fplayers[i].Name
- label.Position = UDim2.new(0,0,0,40+(20*(i-1)))
- label.Parent = playerlist
- label.TextColor3 = ChatColors[GetNameValue(fplayers[i].Name) + 1].Color
- end
- playerlist.Size = UDim2.new(0,168,0,40+(20*#players))
- end
- local lslabels = {} --Player Scores
- for i=1,#players do
- if players[i]:FindFirstChild("leaderstats") then
- local get = players[i].leaderstats:GetChildren()
- for i2=1,#get do
- if get[i2].ClassName == "IntValue" or get[i2].ClassName == "NumberValue" then
- local ret = false
- for i3=1,#lslabels do
- if lslabels[i3].Name == get[i2].Name then
- ret = true
- end
- end
- if ret == false then
- table.insert(lslabels,#lslabels+1,get[i2])
- end
- for i3=1,#lslabels do
- if lslabels[i3].Name == get[i2].Name then
- local nslabel = script:WaitForChild("ScoreLabel"):Clone()
- nslabel.Text = tostring(get[i2].Value)
- if i3 == 1 then
- nslabel.Position = UDim2.new(0,155,0,0)
- else
- nslabel.Position = UDim2.new(0,155+(80/(i3-1)),0,0)
- end
- local get2 = playerlist:GetChildren()
- for i4=1,#get2 do
- if get2[i4].Name == "Team" then
- local get3 = get2[i4]:GetChildren()
- for i5=1,#get3 do
- if get3[i5].Name == "Player" and get3[i5].Text == players[i].Name then
- nslabel.TextColor3 = get3[i5].TextColor3
- nslabel.Parent = get3[i5]
- end
- end
- elseif get2[i4].Name == "Player" and get2[i4].Text == players[i].Name then
- nslabel.Parent = get2[i4]
- end
- end
- end
- end
- end
- end
- end
- end
- local get = playerlist:GetChildren() --Team Scores
- if #teams > 0 then
- for i=1,#get do
- if get[i].Name == "Team" then
- local valtable = {}
- local get2 = get[i]:GetChildren()
- for i2=1,#get2 do
- if get2[i2].Name == "Player" then
- local get3 = get2[i2]:GetChildren()
- for i3=1,#get3 do
- if valtable[i3] then
- valtable[i3] = valtable[i3] + tonumber(get3[i3].Text)
- else
- valtable[i3] = tonumber(get3[i3].Text)
- end
- end
- end
- end
- for i2=1,#valtable do
- local nslabel = script:WaitForChild("ScoreLabel"):Clone()
- nslabel.Text = tostring(valtable[i2])
- if i2 == 1 then
- nslabel.Position = UDim2.new(0,155,0,0)
- else
- nslabel.Position = UDim2.new(0,155+(80/(i2-1)),0,0)
- end
- nslabel.TextColor3 = get[i]:FindFirstChild("_Label2").TextColor3
- nslabel.TextStrokeTransparency = 0.5
- nslabel.Parent = get[i]
- end
- end
- end
- end
- local function sorter(tosort) --Sorting
- local sorted = {}
- local get2 = tosort:GetChildren()
- for i=1,#get2 do
- if get2[i].Name == "Player" then
- if get2[i]:FindFirstChild("ScoreLabel") then
- sorted[get2[i]] = tonumber(get2[i]:FindFirstChild("ScoreLabel").Text)
- else
- sorted[get2[i]] = -math.huge
- end
- end
- end
- local i = 0
- for k,v in spairs(sorted, function(t,a,b) return t[b] < t[a] end) do
- i = i + 1
- k.Position = UDim2.new(0,0,0,30+(20*(i-1)))
- end
- end
- if #teams > 0 then
- for i=1,#get do
- if get[i].Name == "Team" then
- sorter(get[i])
- end
- end
- else
- sorter(playerlist)
- end
- if #lslabels > 0 then --Titles
- playerlist.Position = UDim2.new(1,-330,0,10)
- playerlist.Size = UDim2.new(playerlist.Size.X,320,playerlist.Size.Y,playerlist.Size.Y.Offset)
- for i=1,#lslabels do
- local nslabel = script:WaitForChild("LSLabel"):Clone()
- nslabel.Text = lslabels[i].Name
- if i == 1 then
- nslabel.Position = UDim2.new(0,160,0,0)
- else
- nslabel.Position = UDim2.new(0,160+(80/(i-1)),0,0)
- end
- nslabel.Parent = playerlist
- end
- elseif #teams > 0 then
- playerlist:WaitForChild("_Label1").Text = ""
- for i=1,#get do
- if get[i].Name == "Team" then
- get[i].Position = UDim2.new(get[i].Position.X,get[i].Position.X.Offset,get[i].Position.Y,get[i].Position.Y.Offset-20)
- end
- end
- playerlist.Size = UDim2.new(playerlist.Size.X,playerlist.Size.X.Offset,playerlist.Size.Y,playerlist.Size.Y.Offset-20)
- end
- end
- function updatetlist()
- local f1 = localplayer.Character:GetChildren()
- local f2 = localplayer.Backpack:GetChildren()
- local get = inventory:GetChildren()
- for i=1,#get do
- get[i].Visible = false
- end
- for i=1,#f1 do
- if f1[i].ClassName == "Tool" and indexcheck(f1[i]) == false then
- table.insert(tools,#tools+1,f1[i])
- end
- end
- for i=1,#f2 do
- if f2[i].ClassName == "Tool" and indexcheck(f2[i]) == false then
- table.insert(tools,#tools+1,f2[i])
- end
- end
- for i=1,#tools do
- if i >= 1 and i <= 10 then
- local ret = inv[i]
- if tools[i].TextureId ~= "" then
- inventory["Slot"..ret].ImageLabel.Image = tools[i].TextureId
- inventory["Slot"..ret].Text = ""
- else
- inventory["Slot"..ret].ImageLabel.Image = ""
- inventory["Slot"..ret].Text = " " .. tools[i].Name
- end
- inventory["Slot"..ret].Visible = true
- end
- end
- end
- function updateclist()
- local chats = chatlist:GetChildren()
- for i=1,#chats do
- chats[i].Position = UDim2.new(0,0,0,(i*14)-14)
- end
- end
- function createchat(text)
- workspace.ReceiveChat:InvokeServer(text)
- end
- function activatetool(number)
- local get = localplayer.Character:GetChildren()
- for i=1,#get do
- if get[i].ClassName == "Tool" then
- get[i].Parent = localplayer.Backpack
- end
- end
- if cursel ~= number then
- cursel = number
- inventory["Slot1"].BorderSizePixel = 0
- inventory["Slot2"].BorderSizePixel = 0
- inventory["Slot3"].BorderSizePixel = 0
- inventory["Slot4"].BorderSizePixel = 0
- inventory["Slot5"].BorderSizePixel = 0
- inventory["Slot6"].BorderSizePixel = 0
- inventory["Slot7"].BorderSizePixel = 0
- inventory["Slot8"].BorderSizePixel = 0
- inventory["Slot9"].BorderSizePixel = 0
- inventory["Slot0"].BorderSizePixel = 0
- if tonumber(cursel) <= 10 then
- local ret = inv[tonumber(cursel)]
- inventory["Slot"..ret].BorderSizePixel = 1
- end
- local select = tools[tonumber(number)]
- if select then
- select.Parent = localplayer.Character
- end
- else
- cursel = ""
- inventory["Slot1"].BorderSizePixel = 0
- inventory["Slot2"].BorderSizePixel = 0
- inventory["Slot3"].BorderSizePixel = 0
- inventory["Slot4"].BorderSizePixel = 0
- inventory["Slot5"].BorderSizePixel = 0
- inventory["Slot6"].BorderSizePixel = 0
- inventory["Slot7"].BorderSizePixel = 0
- inventory["Slot8"].BorderSizePixel = 0
- inventory["Slot9"].BorderSizePixel = 0
- inventory["Slot0"].BorderSizePixel = 0
- end
- end
- function sendchat.OnClientInvoke(tuple)
- local username = tuple[1]
- local message = tuple[2]
- local timeout = tuple[3]
- if game:GetService("Players"):FindFirstChild(username) then
- local newchat = script.Chat:Clone()
- newchat.Parent = script
- newchat.Message.Text = " " .. message
- newchat.Username.Text = username .. ":"
- local wid1 = newchat.Message.TextBounds.X
- local wid2 = newchat.Username.TextBounds.X
- local wid3 = wid1 + wid2
- newchat.Message.Size = UDim2.new(0,wid1,0,14)
- newchat.Message.Position = UDim2.new(0,wid2,0,0)
- newchat.Username.Size = UDim2.new(0,wid2,0,14)
- newchat.Size = UDim2.new(0,wid3,0,16)
- if game:GetService("Players"):FindFirstChild(username).Neutral then
- newchat.Username.TextColor3 = ChatColors[GetNameValue(username) + 1].Color
- else
- newchat.Username.TextColor3 = game:GetService("Players"):FindFirstChild(username).TeamColor.Color
- end
- local chats = chatlist:GetChildren()
- if #chats == 6 then
- chats[1]:Destroy()
- end
- newchat.Parent = chatlist
- delay(30-timeout,function()
- if newchat then
- newchat:Destroy()
- end
- end)
- end
- end
- chat.FocusLost:connect(function(enterPressed)
- if enterPressed then
- local text = chat.Text
- chat.ClearTextOnFocus = true
- chat.BackgroundColor3 = Color3.new(64/255,64/255,64/255)
- chat.Filler.BackgroundColor3 = Color3.new(64/255,64/255,64/255)
- chat.TextColor3 = Color3.new(1,1,200/255)
- chat.Text = 'To chat click here or press the "/" key'
- if string.len(text) ~= 0 then
- createchat(text)
- end
- elseif string.len(chat.Text) == 0 then
- chat.ClearTextOnFocus = true
- chat.BackgroundColor3 = Color3.new(64/255,64/255,64/255)
- chat.Filler.BackgroundColor3 = Color3.new(64/255,64/255,64/255)
- chat.TextColor3 = Color3.new(1,1,200/255)
- chat.Text = 'To chat click here or press the "/" key'
- else
- chat.BackgroundColor3 = Color3.new(64/255,64/255,64/255)
- chat.Filler.BackgroundColor3 = Color3.new(64/255,64/255,64/255)
- chat.TextColor3 = Color3.new(1,1,1)
- end
- end)
- chat:WaitForChild("ClickDetect").MouseButton1Click:connect(function()
- chat:CaptureFocus()
- chat.ClearTextOnFocus = false
- chat.BackgroundColor3 = Color3.new(1,1,1)
- chat.Filler.BackgroundColor3 = Color3.new(1,1,1)
- chat.TextColor3 = Color3.new(0,0,0)
- end)
- game:GetService("UserInputService").InputBegan:connect(function(key, gameProcessedEvent)
- local caller, error = pcall(function()
- key = key.KeyCode
- end)
- if not key or not caller or chat.TextColor3 == Color3.new(0,0,0) then
- return
- end
- if key == Enum.KeyCode.One then
- activatetool("1")
- elseif key == Enum.KeyCode.Two then
- activatetool("2")
- elseif key == Enum.KeyCode.Three then
- activatetool("3")
- elseif key == Enum.KeyCode.Four then
- activatetool("4")
- elseif key == Enum.KeyCode.Five then
- activatetool("5")
- elseif key == Enum.KeyCode.Six then
- activatetool("6")
- elseif key == Enum.KeyCode.Seven then
- activatetool("7")
- elseif key == Enum.KeyCode.Eight then
- activatetool("8")
- elseif key == Enum.KeyCode.Nine then
- activatetool("9")
- elseif key == Enum.KeyCode.Zero then
- activatetool("10")
- elseif key == Enum.KeyCode.Slash then
- chat:CaptureFocus()
- chat.ClearTextOnFocus = false
- chat.BackgroundColor3 = Color3.new(1,1,1)
- chat.Filler.BackgroundColor3 = Color3.new(1,1,1)
- chat.TextColor3 = Color3.new(0,0,0)
- 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
- local s = script.SWITCH3:Clone()
- s.Parent = script
- s:Play()
- s:Destroy()
- 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
- for k, v in pairs(walkdisc:GetChildren()) do
- if v.Name == "walkdisc" then
- v.Parent = nil
- end
- end
- end
- end)
- mouse.WheelForward:connect(function()
- local s = script.SWITCH3:Clone()
- s.Parent = script
- s:Play()
- s:Destroy()
- end)
- mouse.WheelBackward:connect(function()
- local s = script.SWITCH3:Clone()
- s.Parent = script
- s:Play()
- s:Destroy()
- end)
- mouse.Button1Down:connect(function()
- if walkdisc.Transparency == 0 and localplayer:DistanceFromCharacter(mouse.Hit.p) <= 50 then
- for k, v in pairs(walkdisc:GetChildren()) do
- if v.Name == "walkdisc" then
- v.Parent = nil
- end
- end
- local newwalk = walkdisc:Clone()
- newwalk.Parent = walkdisc
- while newwalk and localplayer.Character and localplayer.Character:FindFirstChild("Humanoid") and newwalk:IsDescendantOf(walkdisc) and localplayer:DistanceFromCharacter(newwalk.Position) > 5 do
- localplayer.Character.Humanoid:MoveTo(newwalk.Position, newwalk)
- wait()
- end
- newwalk:Destroy()
- end
- end)
- function leaderstatsconnectors(player)
- local children = player:GetChildren() --Connect Existing Leaderstats
- for i=1,#children do
- if children[i].Name == "leaderstats" then
- local children2 = children[i]:GetChildren()
- for i2=1,#children2 do
- if children2[i2].ClassName == "IntValue" or children2[i2].ClassName == "NumberValue" then
- children2[i2].Changed:connect(updateplist)
- end
- end
- children[i].ChildAdded:connect(function(child2)
- if child2.ClassName == "IntValue" or child2.ClassName == "NumberValue" then
- child2.Changed:connect(updateplist)
- updateplist()
- end
- end)
- children[i].ChildRemoved:connect(updateplist)
- updateplist()
- end
- end
- player.ChildAdded:connect(function(child) --Connect New Leaderstats
- if child.Name == "leaderstats" then
- local children2 = child:GetChildren()
- for i2=1,#children2 do
- if children2[i2].ClassName == "IntValue" or children2[i2].ClassName == "NumberValue" then
- children2[i2].Changed:connect(function()
- updateplist()
- end)
- end
- end
- child.ChildAdded:connect(function(child2)
- if child2.ClassName == "IntValue" or child2.ClassName == "NumberValue" then
- child2.Changed:connect(updateplist)
- updateplist()
- end
- end)
- child.ChildRemoved:connect(updateplist)
- updateplist()
- end
- end)
- player.ChildRemoved:connect(function(child) --Connect Removing Leaderstats
- if child.Name == "leaderstats" then
- updateplist()
- end
- end)
- end
- players = game:GetService("Players"):GetChildren() --Connect Existing Players
- for i=1,#players do
- if players[i].ClassName == "Player" then
- players[i].Changed:connect(updateplist)
- leaderstatsconnectors(players[i])
- end
- end
- game:GetService("Players").ChildAdded:connect(function(player) --Connect New Players
- if player.ClassName == "Player" then
- player.Changed:connect(updateplist)
- leaderstatsconnectors(player)
- updateplist()
- end
- end)
- game:GetService("Players").ChildRemoved:connect(function(player) --Connect Removing Players
- if player.ClassName == "Player" then
- updateplist()
- end
- end)
- teams = game:GetService("Teams"):GetChildren() --Connect Existing Teams
- for i=1,#teams do
- if teams[i].ClassName == "Team" then
- teams[i].Changed:connect(updateplist)
- end
- end
- game:GetService("Teams").ChildAdded:connect(function(team) --Connect New Teams
- if team.ClassName == "Team" then
- team.Changed:connect(updateplist)
- updateplist()
- end
- end)
- game:GetService("Teams").ChildRemoved:connect(function(team) --Connect Removing Teams
- if team.ClassName == "Team" then
- updateplist()
- end
- end)
- updateplist() --Player Update
- localplayer.Backpack.ChildAdded:connect(function(tool) --Connect New Tools
- if tool.ClassName == "Tool" then
- if indexcheck(tool) == false then
- tool.Changed:connect(updatetlist)
- end
- updatetlist()
- end
- end)
- localplayer.Backpack.ChildRemoved:connect(function(tool) --Connect Removing Tools
- if tool.ClassName == "Tool" then
- if tool.Parent == localplayer.Character then
- updatetlist()
- else
- table.remove(tools,indexcheck(tool))
- updatetlist()
- end
- end
- end)
- localplayer.Character.ChildAdded:connect(function(tool) --Connect New Tools By Character
- if tool.ClassName == "Tool" then
- local doac = false
- if indexcheck(tool) == false then
- doac = true
- tool.Changed:connect(updatetlist)
- end
- updatetlist()
- if doac == true then
- cursel = tostring(indexcheck(tool))
- inventory["Slot1"].BorderSizePixel = 0
- inventory["Slot2"].BorderSizePixel = 0
- inventory["Slot3"].BorderSizePixel = 0
- inventory["Slot4"].BorderSizePixel = 0
- inventory["Slot5"].BorderSizePixel = 0
- inventory["Slot6"].BorderSizePixel = 0
- inventory["Slot7"].BorderSizePixel = 0
- inventory["Slot8"].BorderSizePixel = 0
- inventory["Slot9"].BorderSizePixel = 0
- inventory["Slot0"].BorderSizePixel = 0
- if tonumber(cursel) <= 10 then
- inventory["Slot"..inv[tonumber(cursel)]].BorderSizePixel = 1
- end
- end
- end
- end)
- localplayer.Character.ChildRemoved:connect(function(tool) --Connect Removing Tools By Character
- if tool.ClassName == "Tool" then
- if tool.Parent == localplayer.Backpack then
- updatetlist()
- if indexcheck(tool) and cursel == tostring(indexcheck(tool)) and not tool.CanBeDropped then
- wait()
- if cursel == tostring(indexcheck(tool)) then
- cursel = ""
- inventory["Slot1"].BorderSizePixel = 0
- inventory["Slot2"].BorderSizePixel = 0
- inventory["Slot3"].BorderSizePixel = 0
- inventory["Slot4"].BorderSizePixel = 0
- inventory["Slot5"].BorderSizePixel = 0
- inventory["Slot6"].BorderSizePixel = 0
- inventory["Slot7"].BorderSizePixel = 0
- inventory["Slot8"].BorderSizePixel = 0
- inventory["Slot9"].BorderSizePixel = 0
- inventory["Slot0"].BorderSizePixel = 0
- end
- end
- else
- table.remove(tools,indexcheck(tool))
- updatetlist()
- cursel = ""
- inventory["Slot1"].BorderSizePixel = 0
- inventory["Slot2"].BorderSizePixel = 0
- inventory["Slot3"].BorderSizePixel = 0
- inventory["Slot4"].BorderSizePixel = 0
- inventory["Slot5"].BorderSizePixel = 0
- inventory["Slot6"].BorderSizePixel = 0
- inventory["Slot7"].BorderSizePixel = 0
- inventory["Slot8"].BorderSizePixel = 0
- inventory["Slot9"].BorderSizePixel = 0
- inventory["Slot0"].BorderSizePixel = 0
- end
- end
- end)
- buttons = inventory:GetChildren() --Connect Inventory Click Selection
- for i=1,#buttons do
- buttons[i].Button.MouseButton1Click:connect(function()
- if buttons[i].NumberLabel.Text == "0" then
- activatetool("10")
- else
- activatetool(buttons[i].NumberLabel.Text)
- end
- end)
- end
- updatetlist() --Tool Update
- chatlist.ChildAdded:connect(updateclist) --Connect Chat
- chatlist.ChildRemoved:connect(updateclist)
- function updateHealth(property) --Connect Health
- percentage = localplayer.Character.Humanoid.Health / localplayer.Character.Humanoid.MaxHealth
- if percentage < 0 then
- percentage = 0
- elseif percentage > 1 then
- percentage = 1
- end
- health:WaitForChild("Score").Position = UDim2.new(0,0,1-percentage,0)
- health:WaitForChild("Score").Size = UDim2.new(1,0,percentage,0)
- end
- localplayer.Character:WaitForChild("Humanoid").Changed:connect(updateHealth)
- localplayer.Character.Humanoid.Died:connect(function() updateHealth("Health") end)
- game:GetService("RunService").RenderStepped:connect(function()
- if cursel ~= "" then
- game:GetService("UserInputService").MouseIconEnabled = true
- gui.Cursor.Visible = false
- else
- game:GetService("UserInputService").MouseIconEnabled = false
- gui.Cursor.Visible = true
- end
- if gui.Cursor.Visible then
- gui.Cursor.Position = UDim2.new(0, mouse.X - 40, 0, mouse.Y - 40)
- if mouse.Target then
- gui.Cursor.Image = "rbxassetid://199228706"
- for k, v in pairs(mouse.Target:GetChildren()) do
- if v.ClassName == "ClickDetector" and localplayer:DistanceFromCharacter(mouse.Hit.p) <= v.MaxActivationDistance then
- gui.Cursor.Image = "rbxassetid://199232395"
- end
- end
- if localplayer:DistanceFromCharacter(mouse.Hit.p) <= 50 then
- walkdisc.CFrame = CFrame.new(mouse.Hit.p)
- walkdisc.Transparency = 0
- else
- walkdisc.Transparency = 1
- end
- else
- gui.Cursor.Image = "rbxassetid://199228762"
- walkdisc.Transparency = 1
- end
- else
- walkdisc.Transparency = 1
- end
- end)
- game:GetService("UserInputService").MouseIconEnabled = false
- game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
- ~~~~~~~~~~~~~~~~~
- 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