Advertisement
KrYn0MoRe

ping script

Apr 20th, 2020 (edited)
5,693
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.73 KB | None | 0 0
  1. local plr = owner
  2. local char = nil
  3. local ptext,pchart
  4. local gp = 0
  5. local ggn = 0
  6. local xx = 0.3
  7.  
  8. plr.CharacterAdded:Connect(function(character)
  9.     char = character
  10.     setup(char)
  11. end)
  12.  
  13. spawn(function()
  14.     local pos = nil
  15.     local torso = nil
  16.     local tempchar = plr.Character
  17.     if tempchar then
  18.         torso = tempchar:FindFirstChild('Torso')
  19.         pos = torso.CFrame
  20.     end
  21.     plr:LoadCharacter()
  22.     tempchar = plr.Character
  23.     if tempchar and pos then
  24.         torso = tempchar:FindFirstChild('Torso')
  25.         if torso then
  26.             torso.CFrame = pos
  27.         end
  28.     end
  29.     start()
  30.     print("Loaded KrYn0MoRe's Ping Display v2")
  31. end)
  32.  
  33. function setup(char)
  34.     local head = char:FindFirstChild('Head')
  35.     local BillboardGui0 = Instance.new("BillboardGui")
  36.     local Frame1 = Instance.new("Frame")
  37.     ptext = Instance.new("TextBox")
  38.     local ImageLabel3 = Instance.new("ImageLabel")
  39.     pchart = Instance.new("Frame")
  40.     BillboardGui0.Name = "PingGui"
  41.     BillboardGui0.Parent = head
  42.     BillboardGui0.Size = UDim2.new(3, 0, 0.8, 0)
  43.     BillboardGui0.StudsOffset = Vector3.new(0, 2.5, 0)
  44.     Frame1.Parent = BillboardGui0
  45.     Frame1.Size = UDim2.new(1, 0, 1, 0)
  46.     Frame1.BackgroundColor3 = Color3.new(0, 0, 0)
  47.     Frame1.BorderColor = BrickColor.new("Institutional white")
  48.     Frame1.BorderColor3 = Color3.new(1, 1, 1)
  49.     ptext.Name = "Ping"
  50.     ptext.Parent = Frame1
  51.     ptext.Size = UDim2.new(0.7, 0, 1, 0)
  52.     ptext.BackgroundColor = BrickColor.new("Institutional white")
  53.     ptext.BackgroundColor3 = Color3.new(1, 1, 1)
  54.     ptext.BackgroundTransparency = 1
  55.     ptext.Font = Enum.Font.SourceSans
  56.     ptext.FontSize = Enum.FontSize.Size14
  57.     ptext.Text = (gp .. " ms")
  58.     ptext.TextColor = BrickColor.new("Institutional white")
  59.     ptext.TextColor3 = Color3.new(1, 1, 1)
  60.     ptext.TextScaled = true
  61.     ptext.TextSize = 14
  62.     ptext.TextStrokeTransparency = 0
  63.     ptext.TextWrap = true
  64.     ptext.TextWrapped = true
  65.     ImageLabel3.Name = "Overlay"
  66.     ImageLabel3.Parent = Frame1
  67.     ImageLabel3.Position = UDim2.new(0.7, 0, 0, 0)
  68.     ImageLabel3.Size = UDim2.new(0.3, 0, 1, 0)
  69.     ImageLabel3.BackgroundTransparency = 1
  70.     ImageLabel3.ZIndex = 2
  71.     ImageLabel3.Image = "rbxassetid://86319878"
  72.     pchart.Name = "PingChart"
  73.     pchart.Parent = Frame1
  74.     pchart.Position = UDim2.new(0.7, 0, 0, 0)
  75.     pchart.Size = UDim2.new(0.3, 0, 1, 0)
  76.     pchart.BackgroundColor = BrickColor.new("Lime green")
  77.     pchart.BackgroundColor3 = Color3.new(0, 1, 0)
  78.     pchart.BorderSizePixel = 0
  79. end
  80.  
  81. function start()
  82.     spawn(function()
  83.         while wait(0.25) do
  84.             if pchart and pchart.Parent and ptext and ptext.Parent then
  85.                 local ping = math.floor(plr:GetNetworkPing()*1000)
  86.                 local X = 0.3 --xx
  87.                 local R = math.clamp(ping/300,0,1)
  88.                 local G = (1-R)
  89.                 pchart.Size = UDim2.new(X,0,1,0)
  90.                 pchart.BackgroundColor3 = Color3.new(R,G,0)
  91.                 ptext.Text = (ping .. ' ms')
  92.             end
  93.         end
  94.     end)
  95. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement