Is this code fine? Using repeat wait() until _condition_

Hello everyone.
It has been around 6 months I am related to scripting and recently I got introduced to OOP which I really wanted to implement and see the results (on how it affects my game).

So I designed this Round System function thing with it’s own functions(Methods) and properties.
Note I don’t know how to format the code in “DevForum” like in “Rblx Studio” and thus I am providing a picture , Sorry.

I was pretty happy with my work as it worked fine and everything was good.
That is when I saw a post which said to not use (repeat wait() until or while true do wait() end) formatting.
As you can see I used repeat wait() …
How can I avoid it and also make my code more efficient!

Note I am really new to this OOP thing and not very experienced and good at scripting so please pardon my mistakes and tell me where to change them and I will do so. Also, if I should have used OOP in a situation like this.
Thank you!

Well, I mean, is it working? Just because someone says don’t use this, it may still work.

You might not have much choice if you need the function to end as soon as self.Running is false. If you don’t though, it’s probably better to increase task.wait to roundTime and ditch the loop since task.wait does behind the scenes pretty much the same thing you’re already doing.

Yes It does work perfectly fine but I saw many posts saying not to use this formatting.

Then what’s the problem with using it? If it works fine, just keep it. I have used these many times, and they may cause a tiny bit of lag on studio but they should work.

There’s more to programming than things which cause lag. The issue with this practice is not efficiency. Mostly, it is abuse of the task scheduler. And with it come the caveats of the task scheduler. There are no benefits to coding in this manner (when it can be avoided) and a lot of reasons to avoid it. Sometimes you don’t have many choices. Primarily though, at every possible avenue you should prefer event-based programming.