Hey there, I know what RunService
is but I want to know where is RunService
used?
Currently when I see RunService it's only events like e.g. Heartbeat
. How is that example used in scripting?
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.
local RunService = game:GetService("RunService") local RATE_PER_SECOND = 2 RunService.Heartbeat:Connect(function(step) local increment = RATE_PER_SECOND * step end)