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

[closed] How to show FPS (FramesPerSecond) on a GUI?

Asked by 4 years ago
Edited 4 years ago

I don't know where to get the FPS from, but here's what I was thinking:

while true do
 script.Parent.TextLabel.Text = "FPS: "..WhereFPSIs
end

I'm thinking it's in workspace.Camera but maybe not.

1 answer

Log in to vote
0
Answered by
VitroxVox 884 Moderation Voter
4 years ago

Here is what you're looking for, you're welcome

wait(0.1)

--// Settings

local fpsGui = script.Parent
local fpsFormat = "FPS: %.2f"
local updateDelay = 0.5

--// Function

function TrackFPS()
    while (true) do
        local fps = game.Workspace:GetRealPhysicsFPS()
        local fpsStr = fpsFormat:format(fps)
        fpsGui.Text = fpsStr
        wait(updateDelay)
    end
end

TrackFPS()

You can change all the settings but remember to change the loaction of the text as well (fpsGui)

If it worked , accept, thanks!

0
Thank you this really helped User#29913 36 — 4y
0
Why do you have an arbritrary wait at the start? hiimgoodpack 2009 — 4y
Ad

Answer this question