Advertisement
Azzz_4565

Untitled

Jun 24th, 2025
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.73 KB | None | 0 0
  1. --// FPS Counter – Dark Gray Background with Message Box for FPS Drop
  2. --   Place this LocalScript in StarterPlayerScripts or StarterGui.
  3.  
  4. --== SERVICES =================================================================
  5. local Players     = game:GetService("Players")
  6. local RunService  = game:GetService("RunService")
  7.  
  8. --== PLAYER & GUI SETUP ========================================================
  9. local player      = Players.LocalPlayer
  10. local playerGui   = player:WaitForChild("PlayerGui")
  11.  
  12. local screenGui   = Instance.new("ScreenGui")
  13. screenGui.Name            = "FPSCounterGui"
  14. screenGui.ResetOnSpawn    = false      -- keeps GUI when you respawn
  15. screenGui.IgnoreGuiInset  = true       -- pushes into the safe-zone
  16. screenGui.Parent          = playerGui
  17.  
  18. --== MAIN FPS LABEL ============================================================
  19. local fpsLabel = Instance.new("TextLabel")
  20. fpsLabel.Name               = "FPSLabel"
  21. fpsLabel.AnchorPoint        = Vector2.new(0, 1)
  22. fpsLabel.Position           = UDim2.new(0, 15, 1, -50)
  23. fpsLabel.Size               = UDim2.new(0, 140, 0, 36)
  24. fpsLabel.BackgroundColor3   = Color3.fromRGB(30, 30, 30)      -- Dark gray background
  25. fpsLabel.BorderSizePixel    = 2
  26. fpsLabel.Text               = "FPS: --"
  27. fpsLabel.TextColor3         = Color3.fromRGB(0, 255, 0)
  28. fpsLabel.Font               = Enum.Font.SourceSansBold
  29. fpsLabel.TextScaled         = true
  30. fpsLabel.Parent             = screenGui
  31.  
  32. -- Rounded corners for the label
  33. local corner = Instance.new("UICorner", fpsLabel)
  34. corner.CornerRadius = UDim.new(0, 6)
  35.  
  36. --== MESSAGE BOX LABEL =======================================================
  37. local messageBox = Instance.new("TextLabel")
  38. messageBox.Name               = "MessageBox"
  39. messageBox.AnchorPoint        = Vector2.new(0, 1)
  40. messageBox.Position           = UDim2.new(0, 15, 1, -100) -- Slightly below the FPS label
  41. messageBox.Size               = UDim2.new(0, 300, 0, 36)
  42. messageBox.BackgroundColor3   = Color3.fromRGB(50, 50, 50)  -- Darker gray background
  43. messageBox.BorderSizePixel    = 2
  44. messageBox.Text               = "FPS is good"
  45. messageBox.TextColor3         = Color3.fromRGB(0, 255, 0)
  46. messageBox.Font               = Enum.Font.SourceSansBold
  47. messageBox.TextScaled         = true
  48. messageBox.Parent             = screenGui
  49.  
  50. -- Rounded corners for the message box
  51. local messageBoxCorner = Instance.new("UICorner", messageBox)
  52. messageBoxCorner.CornerRadius = UDim.new(0, 6)
  53.  
  54. --== ROTATING EMOJI LABEL ======================================================
  55. local emoji = Instance.new("TextLabel")
  56. emoji.Name                   = "Emoji"
  57. emoji.Size                   = UDim2.new(0, 36, 0, 36)
  58. emoji.AnchorPoint            = Vector2.new(0, 1)
  59. emoji.Position               = UDim2.new(0, 160, 1, -50)
  60. emoji.BackgroundTransparency = 1
  61. emoji.Text                   = "😂"
  62. emoji.TextScaled             = true
  63. emoji.Font                   = Enum.Font.SourceSansBold
  64. emoji.TextColor3             = Color3.fromRGB(0, 255, 0)
  65. emoji.Parent                 = screenGui
  66.  
  67. --== FPS CALCULATION ===========================================================
  68. local frameCount = 0
  69. local lastTime   = tick()
  70. local rotation   = 0
  71.  
  72. -- Count frames for one-second intervals (for display)
  73. RunService.RenderStepped:Connect(function()
  74.     -- FPS display timer
  75.     frameCount += 1
  76.     if tick() - lastTime >= 1 then
  77.         local fps = frameCount
  78.         fpsLabel.Text = ("FPS: %d"):format(fps)
  79.  
  80.         -- Update color and emoji based on FPS
  81.         if fps >= 60 then
  82.             fpsLabel.TextColor3 = Color3.fromRGB(0, 255, 0)   -- green
  83.             emoji.Text          = "😂"
  84.             emoji.TextColor3    = Color3.fromRGB(0, 255, 0)
  85.             messageBox.Text     = "FPS is good"
  86.             messageBox.TextColor3 = Color3.fromRGB(0, 255, 0) -- green message
  87.         elseif fps >= 30 then
  88.             fpsLabel.TextColor3 = Color3.fromRGB(255, 170, 0) -- orange
  89.             emoji.Text          = "😅"
  90.             emoji.TextColor3    = Color3.fromRGB(255, 170, 0)
  91.             messageBox.Text     = "Medium FPS - Possible minor lag"
  92.             messageBox.TextColor3 = Color3.fromRGB(255, 170, 0) -- orange message
  93.         else
  94.             fpsLabel.TextColor3 = Color3.fromRGB(255, 0, 0)   -- red
  95.             emoji.Text          = "💀"
  96.             emoji.TextColor3    = Color3.fromRGB(255, 0, 0)
  97.             messageBox.Text     = "Low FPS - High graphics or many players"
  98.             messageBox.TextColor3 = Color3.fromRGB(255, 0, 0)  -- red message
  99.         end
  100.  
  101.         frameCount = 0
  102.         lastTime   = tick()
  103.     end
  104.  
  105.     -- Continuous emoji spin
  106.     rotation += 3
  107.     emoji.Rotation = rotation % 360
  108. end)
  109.  
  110. print("[FPSCounter] Loaded ✔ – now with dark gray theme, message box, and no red border!")
  111.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement