This morning I was experimenting with some run service functionality to change incrementation based on client FPS. Upon some testing, I noticed some extremely odd behavior from Heartbeat:Wait(). My “FPS” is through the roof with :Wait(), but with :Connect() its normal. Here is an example of what I mean
Using this code, I’m getting results of around 7000-8000 FPS which is definitely inaccurate.
local RS = game:GetService("RunService")
while wait(1) do
local ST = tick()
RS.Heartbeat:Wait()
local FPS = 1/(tick() - ST)
print(FPS)
end
Result:
Method 2 gives me normal results of around 60 FPS
local Int = 0
RS.Heartbeat:Connect(function()
Int = Int + 1
end)
while wait(1) do
print(Int)
Int = 0
end
Result:
Something to note is that if I change Heartbeat
to RenderStepped
Method 1 shows normal results.
For my use case I’d like to be able to use method 1. Does anyone know why method 1 acts the way it does?