Show fps and ping
Key RequiredUniversal

Show fps and ping

Universal ScriptLol20pixel20maxLol20pixel20max 64 views 3.2K executesUpdated Jul 21, 2026
Unrated
00
Lua Script•103 lines (2864 chars)
--[[
	FPS & Ping Display
	------------------
	Coloque este script como um LocalScript dentro de StarterPlayer > StarterPlayerScripts.
	Ele cria um pequeno painel no canto superior esquerdo da tela mostrando o FPS e o Ping em tempo real.
]]

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local Stats = game:GetService("Stats")

local player = Players.LocalPlayer

-- Cria a interface
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "FPSPingDisplay"
screenGui.ResetOnSpawn = false
screenGui.Parent = player:WaitForChild("PlayerGui")

local frame = Instance.new("Frame")
frame.Size = UDim2.new(0, 140, 0, 60)
frame.Position = UDim2.new(0, 10, 0, 10)
frame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
frame.BackgroundTransparency = 0.4
frame.BorderSizePixel = 0
frame.Parent = screenGui

local corner = Instance.new("UICorner")
corner.CornerRadius = UDim.new(0, 8)
corner.Parent = frame

local fpsLabel = Instance.new("TextLabel")
fpsLabel.Size = UDim2.new(1, 0, 0.5, 0)
fpsLabel.Position = UDim2.new(0, 0, 0, 0)
fpsLabel.BackgroundTransparency = 1
fpsLabel.Font = Enum.Font.GothamBold
fpsLabel.TextSize = 18
fpsLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
fpsLabel.Text = "FPS: --"
fpsLabel.Parent = frame

local pingLabel = Instance.new("TextLabel")
pingLabel.Size = UDim2.new(1, 0, 0.5, 0)
pingLabel.Position = UDim2.new(0, 0, 0.5, 0)
pingLabel.BackgroundTransparency = 1
pingLabel.Font = Enum.Font.GothamBold
pingLabel.TextSize = 18
pingLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
pingLabel.Text = "Ping: --"
pingLabel.Parent = frame

-- Cálculo de FPS
local frameCount = 0
local elapsedTime = 0

RunService.RenderStepped:Connect(function(deltaTime)
	frameCount = frameCount + 1
	elapsedTime = elapsedTime + deltaTime

	if elapsedTime >= 0.5 then -- atualiza a cada 0.5s
		local fps = math.floor(frameCount / elapsedTime + 0.5)
		fpsLabel.Text = "FPS: " .. fps

		-- Cor muda conforme o desempenho
		if fps >= 50 then
			fpsLabel.TextColor3 = Color3.fromRGB(0, 255, 0)
		elseif fps >= 30 then
			fpsLabel.TextColor3 = Color3.fromRGB(255, 255, 0)
		else
			fpsLabel.TextColor3 = Color3.fromRGB(255, 0, 0)
		end

		frameCount = 0
		elapsedTime = 0
	end
end)

-- Cálculo de Ping (usando Stats do Roblox)
local function updatePing()
	local success, ping = pcall(function()
		return Stats.Network.ServerStatsItem["Data Ping"]:GetValue()
	end)

	if success and ping then
		local pingMs = math.floor(ping)
		pingLabel.Text = "Ping: " .. pingMs .. " ms"

		if pingMs <= 80 then
			pingLabel.TextColor3 = Color3.fromRGB(0, 255, 0)
		elseif pingMs <= 150 then
			pingLabel.TextColor3 = Color3.fromRGB(255, 255, 0)
		else
			pingLabel.TextColor3 = Color3.fromRGB(255, 0, 0)
		end
	else
		pingLabel.Text = "Ping: N/A"
	end
end

while true do
	updatePing()
	task.wait(1) -- atualiza o ping a cada 1 segundo
end

Features & Information

Just show fps and ping
#Fps#Ping

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts