Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I need help with some Frames Per Second display?

Asked by 8 years ago

I cannot find the Frames Per Second option for ROBLOX Studio?

This code does not really work for me.

print(game.Workspace:GetRealPhysicsFPS()

1 answer

Log in to vote
1
Answered by
BlackJPI 2658 Snack Break Moderation Voter Community Moderator
8 years ago

You could always make your own using the Heartbeat event from RunService:

local FPS = 0

game:GetService("Run Service").Heartbeat:connect(function(step)
    FPS = 1/step
end)

This primitive example is very poor however, as it bases the number of frames per second on how long it took to render a single frame. A better way would be to count the number a frames that are made every second:

local FPS = 0
local frames = 0
local elapsed = 0

game:GetService("Run Service").Heartbeat:connect(function(step)
    frames = frames + 1
    elapsed = elapsed + step
    if elapsed >= 1 then
        FPS = frames/elapsed
        frames = 0
        elapsed = 0
    end
end)

There are many other algorithms out there as well that you may like better than these simple approaches.

0
Or did you mean when editing a place in Roblox studio? BlackJPI 2658 — 8y
Ad

Answer this question