Questions about Run Service

I have some questions regarding Run Service. I wanna ask when do I need to use Runs Service . when I’m using local scripts Idk if I need to use Run Service or not .I already read article about Run Service but I just don’t know when to use it. also pls correct me if this post is wrong . Any help is appreciated :smiley: :smiley:


You’re not required to use RunService, you can also use while true do, but I highly advise u not to. The reason as to why is cause while true do clogs up your script and makes it unable to run after it’s loop, and RunService.RenderStepped doesn’t. Also, RunService.RenderStepped's tempo/loop works based off of your FPS. I’m pretty sure while true do doesn’t, but that might be wrong.

Example of while true do;


while true do
  game.Players.LocalPlayer.Character.Health = 0


‘Hey!’ will print, cause it’s before the loop. Hello will not print, cause it’s after the loop.

  game.Players.LocalPlayer.Character.Humanoid.Health = 0


Will print hey, even if it’s after the loop.

I’m trying not to use while loops to much so should I change it to RunService.RenderStepped or something??

All you ever need — you’re welcome.

1 Like

This is incorrect - RunService.RenderStepped:Wait and wait don’t yield in a separate “thread”, that would completely ruin the point of them.

The reason your second code works is because :Connect calls the call back argument passed to it in a new “thread”. Here is a explanation on when to use wait or a 60hz based function:

1 Like

If you want to use multiple loops, I’d strongly advise using RunService.RenderStepped. (That’s what I’m mostly familiar with and have always used.)

I’d also strongly advise to listen to @SilentsReplacement and read their explanation on when to use wait, etc. with RunService.RenderStepped.

So I heard about physic simulations or whatsoever . What does that mean. Can I get an explanations about this.I’m kinda a bit dumb :sweat_smile: :sweat_smile:

Heartbeat is per physics frame and renderstepped is the frame rate i think.

Also you are going to have to disconnect that listener when you’re done, don’t run threads infinitely in the background. Also, you SHOULD be trying to reduce the amount of infinite iterators there will be in your game. Use other events.

or you can wrap the while loop in a spawn() function. But that works just as good. But its best to do…

while RunServce.Stepped:Wait() do


if you want stuff to print after that then do

while RunServce.Stepped:Wait() do



Isn’t that just useless because you’re still calling a runservice function?

So should I change from while loops to renderstepped or just redeucing while loops??

No its still a while loop. (Im pretty sure)

Ill test it out though.

1 Like

Reduce both because infinite iterations are bad both ways.

You’re using : which is calling a function.

So whats the diffrence between renderstepped:wait() and renderstepped:connect()

yeah you still need it to be in a coroutine

The wait, waits for the render to step, and the connect, connects a function to run when the render is stepped.

Which defeats the whole purpose of a loop because it’s literally runservice.

If i disconnect the event how do I connect it back??