Mryeetmemes

FPS counter roblox studio script

Nov 2nd, 2024 (edited)
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.64 KB | None | 0 0
  1. -- you will need a ScreenGui and a TextLabel in StarterGui for this script to work
  2. -- use a LocalScript
  3. -- put the LocalScript inside the TextLabel
  4.  
  5. local RunService = game:GetService("RunService")
  6. local player = game.Players.LocalPlayer
  7.  
  8. local ScreenGui = player.PlayerGui:WaitForChild("ScreenGui")
  9. local TextLabel = ScreenGui:WaitForChild("TextLabel")
  10.  
  11. local lastTime = tick()
  12. local frameCount = 0
  13.  
  14. RunService.RenderStepped:Connect(function()
  15.     frameCount = frameCount + 1
  16.     local currentTime = tick()
  17.     if currentTime - lastTime >= 1 then
  18.         TextLabel.Text = "FPS: " .. frameCount
  19.         frameCount = 0
  20.         lastTime = currentTime
  21.     end
  22. end)
Advertisement
Add Comment
Please, Sign In to add comment