Is RenderStepped:Wait() bad practice?

Is RenderStepped:Wait() inferior to the RenderStepped event or does it really matter?

My guess is that if you’re using RenderStepped anyway, you should just use the event rather than RenderStepped:Wait(). However what if you’re using OOP and had a method inside an object, called every RenderStepped. Would you call the method every frame using RenderStepped (in a local script) or would you make a loop in that method that runs every RenderStepped:Wait(). With that in mind it also calls into question, the fact OOP doesn’t like waiting, so would you instead refer back to calling the method in the object every frame?

–Key
OOP: Object Oriented Programming

2 Likes

RenderStepped:Wait() = fires about every 1/60th of a second, so no matter what this would fire about 60 times a second no matter your fps

.RenderStepped = fires every frame, so for example if you had 150 fps it’d fire 150 times in a second, 30 fps means 30 fires per second, etc

4 Likes

If that’s the case, I would want a local script calling the method every RenderStepped. Correct?

It depends on what you’re trying to do exactly, which is what I don’t know.

What method arre you trying to call every RenderStepped?

If you need something to stay/look the same no matter the FPS, use .RenderStepped and the delta time parameter for multiplying values to compensate for FPS.

I’m using it to update a bodyGyro every renderStepped or renderStepped:Wait(). I’m unsure of which to use.

Oh, then yeah, for sure use .RenderStepped. It’d help if I could see some code though

Putting a Wait method on a connection (RBXScriptSignal) like RenderStepped or Touched, it’ll make the thread yield until the event fires and returns its parameters /arguments. If you add a Wait method to a RenderStepped, it’ll make the script yield until the event is fired, so RenderStepped doesn’t always run at 60 Hz, – its frequency is dependent on your frame rate since it relies on the connection itself to fire, which has its frequency dependent on the machine’s frame rate

cc: @rek_kie

Basically, it doesn’t matter what you use

3 Likes