Advertisement
Parallaxox

FPS Counter

Feb 26th, 2025
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.00 KB | Software | 0 0
  1. --https://youtu.be/DOgBUAabBn0
  2. local RunService = game:GetService("RunService")
  3. local Players = game:GetService("Players")
  4. local player = Players.LocalPlayer
  5. local PlayerGui = player:WaitForChild("PlayerGui")
  6.  
  7. local screenGui = Instance.new("ScreenGui")
  8. screenGui.Name = "FPSGui"
  9. screenGui.Parent = PlayerGui
  10.  
  11. local fpsLabel = Instance.new("TextLabel")
  12. fpsLabel.Size = UDim2.new(0,200,0,50)
  13. fpsLabel.Position = UDim2.new(0,10,0,10)
  14. fpsLabel.BackgroundTransparency = 0.5
  15. fpsLabel.BackgroundColor3 = Color3.new(0,0,0)
  16. fpsLabel.TextColor3 = Color3.new(1,1,1)
  17. fpsLabel.Font = Enum.Font.SourceSansBold
  18. fpsLabel.TextScaled = true
  19. fpsLabel.Text = "FPS: Calculating...."
  20. fpsLabel.Parent = screenGui
  21.  
  22.  
  23. local frameCount = 0
  24. local startTime = tick()
  25.  
  26. RunService.Heartbeat:Connect(function()
  27.     frameCount = frameCount + 1
  28.     local elapsed = tick() - startTime
  29.     if elapsed >= 1 then
  30.         local fps = math.floor(frameCount/elapsed)
  31.         fpsLabel.Text = "FPS: " .. fps
  32.         frameCount = 0
  33.         startTime = tick()
  34.     end
  35. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement