Technically Heartbeat is useful, but I use other keywords for Heartbeat, that are similar. If you want to know more go to Developer.Roblox and check out RunService and Heartbeat, RunService is basically a long list of stuff that roblox allows you to do and also can check if you're in studio, in game etc. RunService while using : which connects a function to a Variable, RunService.Heartbeat which is an Event, and iit runs on a variable frequency. If the game is running 40 fps the heatbeat will fire 40 times a second and the step argument is 1/40th of a second.
1 | local RunService = game:GetService( "RunService" ) |
3 | local RATE_PER_SECOND = 2 |
5 | RunService.Heartbeat:Connect( function (step) |
6 | local increment = RATE_PER_SECOND * step |