
Key RequiredUniversal

local Players = game:GetService("Players")
local Stats = game:GetService("Stats")
local RunService = game:GetService("RunService")
local Camera = workspace.CurrentCamera
local Player = Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
local BaseScale = 1080
local GUI = Instance.new("ScreenGui")
GUI.Name = "PingIndicator"
GUI.ResetOnSpawn = false
GUI.Parent = PlayerGui
local UIScale = Instance.new("UIScale")
UIScale.Parent = GUI
local Holder = Instance.new("Frame")
Holder.AnchorPoint = Vector2.new(0,0)
Holder.Position = UDim2.new(0,20,0,20)
Holder.Size = UDim2.new(0,60,0,60)
Holder.BackgroundTransparency = 1
Holder.Parent = GUI
local Icon = Instance.new("ImageLabel")
Icon.BackgroundTransparency = 1
Icon.AnchorPoint = Vector2.new(0.5,0)
Icon.Position = UDim2.new(0.5,0,0,0)
Icon.Size = UDim2.new(0,32,0,32)
Icon.Parent = Holder
local PingNumber = Instance.new("TextLabel")
PingNumber.BackgroundTransparency = 1
PingNumber.AnchorPoint = Vector2.new(0.5,0)
PingNumber.Position = UDim2.new(0.5,0,0,32)
PingNumber.Size = UDim2.new(1,0,0,16)
PingNumber.Font = Enum.Font.GothamBold
PingNumber.TextScaled = true
PingNumber.Text = "0"
PingNumber.Parent = Holder
local PingMS = Instance.new("TextLabel")
PingMS.BackgroundTransparency = 1
PingMS.AnchorPoint = Vector2.new(0.5,0)
PingMS.Position = UDim2.new(0.5,0,0,46)
PingMS.Size = UDim2.new(1,0,0,14)
PingMS.Font = Enum.Font.GothamBold
PingMS.TextScaled = true
PingMS.Text = "MS"
PingMS.Parent = Holder
local WifiAlertIcon = "rbxassetid://96827252047441"
local WifiIcon = "rbxassetid://128764644894942"
local function updateScale()
local viewport = Camera.ViewportSize
UIScale.Scale = viewport.Y / BaseScale
end
updateScale()
Camera:GetPropertyChangedSignal("ViewportSize"):Connect(updateScale)
local function getPing()
local str = Stats.Network.ServerStatsItem["Data Ping"]:GetValueString()
local num = tonumber(string.match(str,"%d+"))
return num or 0
end
RunService.RenderStepped:Connect(function()
local ping = getPing()
PingNumber.Text = tostring(ping)
if ping >= 300 then
Icon.Image = WifiAlertIcon
local c = Color3.fromRGB(255,60,60)
Icon.ImageColor3 = c
PingNumber.TextColor3 = c
PingMS.TextColor3 = c
elseif ping >= 80 then
Icon.Image = WifiIcon
local c = Color3.fromRGB(255,210,0)
Icon.ImageColor3 = c
PingNumber.TextColor3 = c
PingMS.TextColor3 = c
else
Icon.Image = WifiIcon
local c = Color3.fromRGB(0,255,120)
Icon.ImageColor3 = c
PingNumber.TextColor3 = c
PingMS.TextColor3 = c
end
end)No comments yet for this script.



