Advertisement
GaryScripts

Untitled

Mar 1st, 2021
929
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.72 KB | None | 0 0
  1. local FpsLabel = script.Parent
  2. local Heartbeat = game:GetService("RunService").Heartbeat
  3.  
  4. local LastIteration, Start
  5. local FrameUpdateTable = { }
  6.  
  7. local function HeartbeatUpdate()
  8.     LastIteration = tick()
  9.     for Index = #FrameUpdateTable, 1, -1 do
  10.         FrameUpdateTable[Index + 1] = (FrameUpdateTable[Index] >= LastIteration - 1) and FrameUpdateTable[Index] or nil
  11.     end
  12.  
  13.     FrameUpdateTable[1] = LastIteration
  14.     local CurrentFPS = (tick() - Start >= 1 and #FrameUpdateTable) or (#FrameUpdateTable / (tick() - Start))
  15.     CurrentFPS = math.floor(CurrentFPS)
  16.     FpsLabel.Text = CurrentFPS .. " FPS"
  17. end
  18.  
  19. Start = tick()
  20. wait(1)
  21. Heartbeat:Connect(HeartbeatUpdate)
  22.  
  23. --code made by randomStuffz
  24. --modified by kurt faircloth/kurtfan5468
  25.  
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement