How to make sure RenderStepped reads the entirity of a script before moving on to a new frame?

  1. What do you want to achieve? I want to make sure RenderStepped doesn’t move on to another frame, until the entire code is read

  2. What is the issue? I have a script… inside the script is a long code with a bunch of if statements, this long code with tons of if statements are nested in a RenderStepped, somehow the code in the RenderStepped, specifically the If-statements doesn’t get read

  3. What solutions have you tried so far? I’ve rearranged the code countless times

I’ve considered using BindToRenderStepped but Im not sure what it is exactly


What is BindToRenderStepped
Can you bind and unbind with in the RenderStepped function? or you can only do it outside the RenderStepped function?

Would it be the solution for my problem(script not reading the entirity of the code, if statements specifically)?

If this would not be the solution, what other alternatives can I do, that would make the script read the entire code

You can use a debouce like in click detectors and gui buttons for example.

local db = false

  if not db then
     db = true
     --your script
     db = false

Ive already done that but the code still ignores the if-statements

Does the code work outside of the renderstepped?
It’s possible some condition isn’t met and it skips them.

No, it doesnt work outside the renderstepped, once its outside it doesn’t repeat.

If you put a print at the end of the RenderStepped function, does it print? If it does, you need to fix your if statements

Yeah their really is a problem in the if statements, the condition is not met hence it seems like the script is ignoring it, Man! How could I have noticed this just now, ive been troubleshooting for so long but the problem was acually extremely simple, Thanks for you help bnx and Jarod

1 Like