Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

what does a stepped runservice loop do?

Asked by
luaa233 37
5 years ago

ive heard about this loop being special. am i wrong?

game:GetService("RunService").Stepped:Connect(function()

end

2 answers

Log in to vote
1
Answered by
KDarren12 705 Donator Moderation Voter
5 years ago

Yes, I guess in a way they are "special", or, different than other loops. When this runs, it is hard to pinpoint what it does. It ignores waits and doesn't stop when there is an error; it prints it forever unless stopped.

Ad
Log in to vote
0
Answered by 5 years ago

Here is the best way for me to explain this: Roblox runs physics calculations 240 times a second (240 Hz). This event, RunService.Stepped gets fired every frame prior to the physics calculation. There are also some other events, like RunService.Heartbeat which fires every frame after the physics calculation, and RunService.RenderStepped which fires every frame prior to a frame being rendered. I hope this helped!

Answer this question