:BindToRenderStep() Vs RunService.RenderStepped()

The headline says everything, what is the difference and when to use what?

3 Likes

There are 2 main differences with BindToRenderStep.

  • Priority - Very easy way to guarantee the functions will fire in order (used by things like character/camera scripts to make sure Camera updates first, see RenderPriority)
  • Associated Name - You don’t need to keep track of a connection, you can disconnect it by passing the name through the UnbindFromRenderStep

If you never disconnect the function and don’t need the priority (which you probably will, considering running code on RenderStepped should only be used for camera/character/input related things) then you should see no difference.

22 Likes

If you need to control exactly when you bind within Roblox’s render pipeline, you want to use :BindToRenderStep(). This helps coordinate actions between scripts messing with the camera.

Check out this:

2 Likes

Thx, @Quenty and @Halalaluyafail3, but How can I always know which priority I have to use and can I for example set the priority between 0 and 100, if yes, what impact does this have with the code?

Order is all relative, but Roblox binds to certain benchmarks based upon priority.

image

So anything between 0 and 100 will run before input runs. So if you want an action to occur before the camera updates, but after the player has already input actions (so for example, slowing down the camera movement, you’d want to bind between 100 and 200. There’s extra space between them so you can bind your own custom things between any of them.

10 Likes

And when i write the Priority with 50?
Edit: Forget that, thank you very much, I understand the difference now (approximately).

4 Likes