I want know if my Code to know the framerate of a player work correctly, here is my code (its a localscript inside the PlayerGui (StarterGui)):
local TextLabel = script.Parent.ScreenGui.TextLabel
local RunService = game:GetService("RunService")
RunService.RenderStepped:Connect(function(step)
local fps = 1/step
if fps < 60 then
print(fps)
TextLabel.Text = tostring(fps)
end
end)
Lol that’s not what I meant. If they want us to review the code we should know the purpose of it. I was asking what the purpose of only printing when less than 60 is, to determine if it’s necessary. I’ll edit my original reply.
If anyone manages to run their client faster by modifying it, you won’t know their fps.
This is probably the best you can do right now, I can’t think of another way but to Bind to RenderStep Service and add a Setting to toggle it On and Off for players.
–
You don’t have to use tostring there, it’s automatic
That way you don’t have to execute this on every frame. Here’s an example based off your current code:
local TextLabel = script.Parent.ScreenGui.TextLabel
while wait(1) do
local fps = workspace:GetRealPhysicsFPS()
if fps < 60 then
print(fps)
TextLabel.Text = tostring(fps)
end
end
Ok, FPS (Frames Per Seconds), to get the FPS i need to execute this on every frame. The render FPS is the elapsed time between 2 Frames, if i forgot or dont add a frame the calculus will be false.