#FPS Counter Bug

44 messages · Page 1 of 1 (latest)

flint glade
#

Try this

#

local RunService = game:GetService("RunService")
local FpsLabel = script.Parent.FPSShow

-- Use a simpler time tracking method
local frameCount = 0
local lastTime = tick()
local updateInterval = 0.5 -- Update every half second

local function updateFPS()
frameCount = frameCount + 1
local currentTime = tick()
local deltaTime = currentTime - lastTime

-- Only update display every updateInterval seconds
if deltaTime >= updateInterval then
    local fps = math.floor(frameCount / deltaTime + 0.5) -- Round to nearest integer
    FpsLabel.Text = tostring(fps)
    frameCount = 0
    lastTime = currentTime
end

end

-- Disconnect any existing connection first
if script.Parent:FindFirstChild("HeartbeatConnection") then
script.Parent.HeartbeatConnection:Disconnect()
end

-- Store the connection so we can disconnect it later if needed
local connection = RunService.Heartbeat:Connect(updateFPS)
script.Parent:WaitForChild("HeartbeatConnection", 5) -- Wait up to 5 seconds
script.Parent.HeartbeatConnection = connection

#

I’m at work rn on break can’t really do much else. But you’re welcome anyway

#

Heart beat is the server side equivalent to render stepped.

Here’s a client side version. If you’re not skilled scripting don’t be so picky about your responses considering they are free.

local RunService = game:GetService("RunService")
local FpsLabel = script.Parent.FPSShow

local frameTimes = {}
local maxSamples = 30 -- Number of recent frame times to average
local updateInterval = 0.1 -- Update display every 0.1 seconds
local lastUpdate = tick()

local function updateFPS(deltaTime)
-- Add the current frame's delta time
table.insert(frameTimes, deltaTime)

-- Remove old samples
if #frameTimes > maxSamples then
    table.remove(frameTimes, 1)
end

-- Only update the display at our specified interval
local currentTime = tick()
if currentTime - lastUpdate >= updateInterval then
    -- Calculate average FPS
    local totalTime = 0
    for _, dt in ipairs(frameTimes) do
        totalTime = totalTime + dt
    end
    
    local averageDelta = totalTime / #frameTimes
    local fps = math.floor(1 / averageDelta + 0.5) -- Round to nearest integer
    
    -- Ensure we show something even at very low FPS
    if fps < 1 then fps = 1 end -- Minimum display value
    FpsLabel.Text = tostring(fps)
    
    lastUpdate = currentTime
end

end

-- Clean up any existing connection
local existingConnection = script:GetAttribute("RenderConnection")
if existingConnection then
existingConnection:Disconnect()
end

-- Connect and store the connection
local connection = RunService.RenderStepped:Connect(updateFPS)
script:SetAttribute("RenderConnection", connection)

#

Now if it works you owe AI an apology 🤣

arctic gyro
#

lol

torn ruin
#
script:SetAttribute("RenderConnection", connection)

fr?

flint glade
torn ruin
#

connection is not valid for an attribute

flint glade
#

And this is why you need to know how to code in the first place before utilizing AI. AI is very useful but if you don’t know what you’re doing then AI won’t be that much help.

#

Make the adjustments as needed. AI isn’t a crutch, it’ll get you in the ball park but you still have to hit the ball.

waxen widget
flint glade
waxen widget
flint glade
#

Grey role with over 1B visits but it is what it is.

swift lintelBOT
#
@Jaxavali
Username
ID

7745744066

Account Created

<t:1735010315:F>

Description

No description available.

waxen widget
flint glade
#

New account big boy

flint glade
brisk vineBOT
#

studio** You are now Level 3! **studio

flint glade
#

Look Jaxavali up on twitter/X 😂

waxen widget
flint glade
waxen widget
flint glade
flint glade
waxen widget
flint glade
#

I guess I bought the 40k+ followers too 😂

flint glade
#

What your username I’ll shout you out rn

waxen widget
flint glade
waxen widget
craggy fulcrum
#

i dare you to make an fps limiter like i did one

#

in the video

flint glade
#

Check my posts

craggy fulcrum
#

nice it still doesnt change that you're a chatgpt warrior

flint glade
waxen widget
# flint glade Well, it is what it is. I’ve made over $80k on Roblox so…

That doesn't change anything though

How many visits you have, or how much money you make, doesnt change that you pasted unvalidated AI code, which can confuse devs and take up space.

Just only help if you have the time to sit down and offer up solutions that you didn't copy and paste without parsing.

Thats all I'm truly saying. Help is appreciated, but you have to be careful with the kind of help you give.

flint glade
torn ruin
waxen widget