How does Heartbeat work exactly and how would I use it? I've been trying to figure out how to use it for a while now, and it's only been working in studio. Can anyone give me a quick run through?
game:GetService("RunService").Heartbeat:connect(function() --Script here end)
I've been treating it as if it were just a loop. Like this:
while true do --Script here end
No matter what I do 'Heartbeat' just doesnt work. Only in studio.
RunService
is what literally keeps time for games; making you jump to place when you stop lagging and must be viewed from a local script in the client not the server.
Heartbeat
is the FPS essentially. Frames per second. It fires every time your computer attempts to update its screen.
If you are looking for a more trustworthy loop that doesn't change depending on lag, use Stepped