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

How do i detect framerate in my game?

Asked by 8 years ago

Hi i'm trying to make a first person shooter and on my gui i'm not entirely sure how to detect framerate. I've tried Renderstep and game.Workspace:GetRealPhysicsFPS

but nothing is seeming to work without it giving me 0 or 1#.INF

Here is my script:

local FPS = 1/game:GetService("RunService").RenderStepped:wait()
script.Parent.Text = FPS

For some reason all it shows is 1#.INF and never changes.

EDIT: Before you ask if i've looked at the wiki or googled it, yes. but most of its "How to increase framerate while playing roblox" and on the wiki it just tells me that renderstep is just another way to utilize wait()

0
You may need to loop that script? xuefei123 214 — 8y

2 answers

Log in to vote
1
Answered by 8 years ago

You should loop it.

local obj = script.Parent;
local RenderStepped = game:GetService("RunService").RenderStepped
while true do
    obj.Text = RenderStepped:wait()^-1;
end;

If you're not sure, x^-1 is the same as 1/x, but it does a check for 0.

Ad
Log in to vote
-2
Answered by 8 years ago

You detect it locally using GetRealPhysicsFPS

1
That returns the number of frames per second that physics are being simulated at, not the player's FPS that he's asking for. User#11440 120 — 8y
0
I'll second this. User#6546 35 — 8y

Answer this question