HUD FPS freakout

When I use this code to show my FPS on my hud:

[lua]local fps = tostring(math.floor( 1/FrameTime()))[/lua]

Then it just freaks out with numbers, going from 150 frame rate to 35 in a millisecond. How do I change it to normal?

The problem with that is it isn’t averaging it. The frametime can jump around like crazy depending on what you are looking at. You would have to average the current value with at least the last one to get a somewhat stable fps.

[lua]local fps = 30

hook.Add(“HUDPaint” , 0 , function()
fps = Lerp(0.3,fps,1/FrameTime())

-- Draw stuff

end )[/lua]

It’s still going crazy. It’s averaging around 30/40 fps, but it jumps around that with numbers like

30.9059000034583459 and stuff.

**[Math.Round

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Math.Round) ?**