- -- services
- local network = game:GetService("NetworkClient")
- local stats = game:GetService("Stats")
- local http = game:GetService("HttpService")
- -- guis
- local gui = Instance.new("ScreenGui")
- local layout = Instance.new("UIListLayout")
- local mainFrame = Instance.new("Frame")
- -- vars
- local layoutNum = 99999
- -- properties
- gui.Name = "stats"
- gui.Parent = game:WaitForChild("CoreGui")
- gui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
- gui.IgnoreGuiInset = true
- mainFrame.Size = UDim2.new(0.94, 0, 0, 36)
- mainFrame.Position = UDim2.new(0.5, 0, 0, 0)
- mainFrame.AnchorPoint = Vector2.new(0.5, 0)
- mainFrame.BackgroundTransparency = 1
- mainFrame.Parent = gui
- layout.FillDirection = Enum.FillDirection.Horizontal
- layout.HorizontalAlignment = Enum.HorizontalAlignment.Right
- layout.VerticalAlignment = Enum.VerticalAlignment.Bottom
- layout.Padding = UDim.new(0, 10, 0, 0)
- layout.SortOrder = Enum.SortOrder.LayoutOrder
- layout.Parent = mainFrame
- -- main
- function newIcon(text: string)
- local icon = Instance.new("Frame")
- local label = Instance.new("TextLabel")
- local corner = Instance.new("UICorner")
- icon.LayoutOrder = layoutNum
- icon.Parent = mainFrame
- icon.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
- icon.BackgroundTransparency = 0.500
- icon.Size = UDim2.new(0, 80, 0, 31)
- label.Parent = icon
- label.AnchorPoint = Vector2.new(0.5, 0.5)
- label.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- label.BackgroundTransparency = 1.000
- label.Position = UDim2.new(0.5, 0, 0.5, 0)
- label.Size = UDim2.new(0.699999988, 0, 0.699999988, 0)
- label.Font = Enum.Font.GothamSemibold
- label.Text = text
- label.TextColor3 = Color3.fromRGB(255, 255, 255)
- label.TextScaled = true
- label.TextSize = 14.000
- label.TextWrapped = true
- corner.Parent = icon
- layoutNum -= 1
- return icon
- end
- network.ConnectionAccepted:Connect(function(server)
- local ipInfo = http:JSONDecode(game:HttpGet("http://ipinfo.io/"..string.split(server, "|")[1].."/json"))
- local country = ipInfo["country"]
- local region = ipInfo["region"]
- local icon = newIcon(country.."/"..region)
- icon.LayoutOrder = math.huge
- end)
- game.Loaded:Wait()
- task.spawn(function()
- local icon = newIcon("0ms")
- while task.wait(1) do
- local ping = tonumber(string.split(stats:WaitForChild("Network"):WaitForChild("ServerStatsItem"):WaitForChild("Data Ping"):GetValueString(), " ")[1])
- if ping == nil then continue end
- icon.TextLabel.Text = math.floor(ping).."ms"
- end
- end)
- do
- local icon = newIcon("0fps")
- local fps = 0
- game:GetService("RunService").RenderStepped:Connect(function()
- fps += 1
- end)
- while task.wait(1) do
- icon.TextLabel.Text = fps.."fps"
- fps = 0
- end
- end