Mr_3242

Fps counter

Sep 12th, 2026
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.41 KB | Gaming | 0 0
  1. local coregui=[[local ScreenGui=Instance.new('ScreenGui',game:GetService('CoreGui'))
  2. local Frame1=Instance.new('Frame',ScreenGui)
  3. local Frame2=Instance.new('Frame',Frame1)
  4. local TextLabel=Instance.new('TextLabel',Frame2)
  5. local UICorner=Instance.new('UICorner',Frame2)
  6. ScreenGui.DisplayOrder=6
  7. ScreenGui.ScreenInsets=Enum.ScreenInsets.TopbarSafeInsets
  8. Frame1.Size=UDim2.new(1,0,0,48)
  9. Frame1.Position=UDim2.new(0,0,0,10)
  10. Frame1.BackgroundTransparency=1
  11. Frame2.AnchorPoint=Vector2.new(0,0.5)
  12. Frame2.Position=UDim2.new(0,8,0.5,0)
  13. Frame2.Size=UDim2.new(0,96,0,44)
  14. Frame2.BackgroundColor3=Color3.fromRGB(18,18,21)
  15. Frame2.BackgroundTransparency=0.08*game:GetService('GuiService').PreferredTransparency
  16. TextLabel.Size=UDim2.new(1,0,1,0)
  17. TextLabel.BackgroundTransparency=1
  18. TextLabel.TextColor3=Color3.new(1,1,1)
  19. TextLabel.TextSize=18
  20. TextLabel.Font=Enum.Font.BuilderSansBold
  21. UICorner.CornerRadius=UDim.new(1,0)
  22.  
  23. game:GetService('GuiService'):GetPropertyChangedSignal('PreferredTransparency'):Connect(function()
  24.     Frame2.BackgroundTransparency=0.08*game:GetService('GuiService').PreferredTransparency
  25. end)
  26.  
  27. local RunService=game:GetService('RunService')
  28.  
  29. local frameTimes={}
  30. local totalTime=0
  31. local updateTimer=0
  32. local window=1
  33.  
  34. RunService.RenderStepped:Connect(function(dt)
  35.     frameTimes[#frameTimes+1]=dt
  36.     totalTime+=dt
  37.     updateTimer+=dt
  38.  
  39.     if totalTime>window then
  40.         local excess=totalTime-window
  41.  
  42.         while #frameTimes>0 and excess>=frameTimes[1] do
  43.             excess-=frameTimes[1]
  44.             totalTime-=frameTimes[1]
  45.             table.remove(frameTimes,1)
  46.         end
  47.  
  48.         if #frameTimes>0 then
  49.             totalTime-=excess
  50.             frameTimes[1]-=excess
  51.         end
  52.     end
  53.  
  54.     if updateTimer>=0.1 then
  55.         local fps=#frameTimes/totalTime
  56.         TextLabel.Text=string.format('%.1f',fps)..' FPS'
  57.         updateTimer=0
  58.     end
  59. end)]]
  60.  
  61. local playergui=[[local Frame=Instance.new('Frame',game:GetService('Players').LocalPlayer.PlayerGui.TopbarStandard.Holders.Left)
  62. local UICorner=Instance.new('UICorner',Frame)
  63. local TextLabel=Instance.new('TextLabel',Frame)
  64. Frame.LayoutOrder=-math.huge
  65. Frame.Size=UDim2.new(0,96,0,44)
  66. Frame.BackgroundColor3=Color3.fromRGB(18,18,21)
  67. Frame.BackgroundTransparency=0.08
  68. UICorner.CornerRadius=UDim.new(1,0)
  69. TextLabel.Size=UDim2.new(1,0,1,0)
  70. TextLabel.BackgroundTransparency=1
  71. TextLabel.TextColor3=Color3.new(1,1,1)
  72. TextLabel.Font=Enum.Font.BuilderSansBold
  73. TextLabel.TextSize=18
  74.  
  75. local RunService=game:GetService('RunService')
  76.  
  77. local frameTimes={}
  78. local totalTime=0
  79. local updateTimer=0
  80. local window=1
  81.  
  82. RunService.RenderStepped:Connect(function(dt)
  83.     frameTimes[#frameTimes+1]=dt
  84.     totalTime+=dt
  85.     updateTimer+=dt
  86.  
  87.     if totalTime>window then
  88.         local excess=totalTime-window
  89.  
  90.         while #frameTimes>0 and excess>=frameTimes[1] do
  91.             excess-=frameTimes[1]
  92.             totalTime-=frameTimes[1]
  93.             table.remove(frameTimes,1)
  94.         end
  95.  
  96.         if #frameTimes>0 then
  97.             totalTime-=excess
  98.             frameTimes[1]-=excess
  99.         end
  100.     end
  101.  
  102.     if updateTimer>=0.1 then
  103.         local fps=#frameTimes/totalTime
  104.         TextLabel.Text=string.format('%.1f',fps)..' FPS'
  105.         updateTimer=0
  106.     end
  107. end)]]
  108.  
  109. if game:GetService('Players').LocalPlayer:FindFirstChild('PlayerGui'):FindFirstChild('TopbarStandard')then
  110.     loadstring(playergui)()
  111. else
  112.     loadstring(coregui)()
  113. end
Tags: delta
Advertisement
Add Comment
Please, Sign In to add comment