Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do i detect framerate in my game?

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()

1 comment

0

You may need to loop that script?

2 answers

✓ Accepted answer

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.

You detect it locally using GetRealPhysicsFPS

2 comments

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.

0

I'll second this.

This discussion is preserved as it was. New answers, comments, and votes are closed.