Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --// FPS Counter – Dark Gray Background with Message Box for FPS Drop
- -- Place this LocalScript in StarterPlayerScripts or StarterGui.
- --== SERVICES =================================================================
- local Players = game:GetService("Players")
- local RunService = game:GetService("RunService")
- --== PLAYER & GUI SETUP ========================================================
- local player = Players.LocalPlayer
- local playerGui = player:WaitForChild("PlayerGui")
- local screenGui = Instance.new("ScreenGui")
- screenGui.Name = "FPSCounterGui"
- screenGui.ResetOnSpawn = false -- keeps GUI when you respawn
- screenGui.IgnoreGuiInset = true -- pushes into the safe-zone
- screenGui.Parent = playerGui
- --== MAIN FPS LABEL ============================================================
- local fpsLabel = Instance.new("TextLabel")
- fpsLabel.Name = "FPSLabel"
- fpsLabel.AnchorPoint = Vector2.new(0, 1)
- fpsLabel.Position = UDim2.new(0, 15, 1, -50)
- fpsLabel.Size = UDim2.new(0, 140, 0, 36)
- fpsLabel.BackgroundColor3 = Color3.fromRGB(30, 30, 30) -- Dark gray background
- fpsLabel.BorderSizePixel = 2
- fpsLabel.Text = "FPS: --"
- fpsLabel.TextColor3 = Color3.fromRGB(0, 255, 0)
- fpsLabel.Font = Enum.Font.SourceSansBold
- fpsLabel.TextScaled = true
- fpsLabel.Parent = screenGui
- -- Rounded corners for the label
- local corner = Instance.new("UICorner", fpsLabel)
- corner.CornerRadius = UDim.new(0, 6)
- --== MESSAGE BOX LABEL =======================================================
- local messageBox = Instance.new("TextLabel")
- messageBox.Name = "MessageBox"
- messageBox.AnchorPoint = Vector2.new(0, 1)
- messageBox.Position = UDim2.new(0, 15, 1, -100) -- Slightly below the FPS label
- messageBox.Size = UDim2.new(0, 300, 0, 36)
- messageBox.BackgroundColor3 = Color3.fromRGB(50, 50, 50) -- Darker gray background
- messageBox.BorderSizePixel = 2
- messageBox.Text = "FPS is good"
- messageBox.TextColor3 = Color3.fromRGB(0, 255, 0)
- messageBox.Font = Enum.Font.SourceSansBold
- messageBox.TextScaled = true
- messageBox.Parent = screenGui
- -- Rounded corners for the message box
- local messageBoxCorner = Instance.new("UICorner", messageBox)
- messageBoxCorner.CornerRadius = UDim.new(0, 6)
- --== ROTATING EMOJI LABEL ======================================================
- local emoji = Instance.new("TextLabel")
- emoji.Name = "Emoji"
- emoji.Size = UDim2.new(0, 36, 0, 36)
- emoji.AnchorPoint = Vector2.new(0, 1)
- emoji.Position = UDim2.new(0, 160, 1, -50)
- emoji.BackgroundTransparency = 1
- emoji.Text = "😂"
- emoji.TextScaled = true
- emoji.Font = Enum.Font.SourceSansBold
- emoji.TextColor3 = Color3.fromRGB(0, 255, 0)
- emoji.Parent = screenGui
- --== FPS CALCULATION ===========================================================
- local frameCount = 0
- local lastTime = tick()
- local rotation = 0
- -- Count frames for one-second intervals (for display)
- RunService.RenderStepped:Connect(function()
- -- FPS display timer
- frameCount += 1
- if tick() - lastTime >= 1 then
- local fps = frameCount
- fpsLabel.Text = ("FPS: %d"):format(fps)
- -- Update color and emoji based on FPS
- if fps >= 60 then
- fpsLabel.TextColor3 = Color3.fromRGB(0, 255, 0) -- green
- emoji.Text = "😂"
- emoji.TextColor3 = Color3.fromRGB(0, 255, 0)
- messageBox.Text = "FPS is good"
- messageBox.TextColor3 = Color3.fromRGB(0, 255, 0) -- green message
- elseif fps >= 30 then
- fpsLabel.TextColor3 = Color3.fromRGB(255, 170, 0) -- orange
- emoji.Text = "😅"
- emoji.TextColor3 = Color3.fromRGB(255, 170, 0)
- messageBox.Text = "Medium FPS - Possible minor lag"
- messageBox.TextColor3 = Color3.fromRGB(255, 170, 0) -- orange message
- else
- fpsLabel.TextColor3 = Color3.fromRGB(255, 0, 0) -- red
- emoji.Text = "💀"
- emoji.TextColor3 = Color3.fromRGB(255, 0, 0)
- messageBox.Text = "Low FPS - High graphics or many players"
- messageBox.TextColor3 = Color3.fromRGB(255, 0, 0) -- red message
- end
- frameCount = 0
- lastTime = tick()
- end
- -- Continuous emoji spin
- rotation += 3
- emoji.Rotation = rotation % 360
- end)
- print("[FPSCounter] Loaded ✔ – now with dark gray theme, message box, and no red border!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement