This may help a lot of smal devs!
1 Like
Don’t use wait, use task.wait.
Wow thanks so much bro! I’ll defo use this
1 Like
just use 1/game:GetService"RunService".RenderStepped:Wait()
2 Likes
Thanks! usually the methods i was finding were absurd but this one is very practical.
I saw this and thought of another way of doing it, basically the same thing but you can use an interval to get possible faster results.
WARNING
the lower the number the less accurate the results will be
local RunService = game:GetService("RunService")
local TextLabel = script.Parent -- Assuming the FPS counter is a child of a TextLabel
local frames = 0
RunService.RenderStepped:Connect(function()
frames = frames + 1
end)
local interval = .7
while wait(interval) do
TextLabel.Text = "FPS: " .. math.round(frames/interval)
frames = 0
end
As shown, results can go above the allowed fps(60) and but will for the most part stay somewhat accurate
Make sure to keep the math,round if you are using decimals, you can get .66666, .333333, ect ruining the counter.