Stop using while true do or repeat until to check for changes

Not sure where to post this but

Stop using wtd and rep until to check if a property changed, for example you might check changes like:
repeat wait() until property == not the same
You could make it
part:GetPropertyChangedSignal("property"):Connect(function)

Why?

because wtd costs more performance than changed

and because wtd yields and interrupts script while changed doesn’t interrupt script.

I posted this because I saw so many codes with while true do just to check for changes

5 Likes

Yeah this is much better than polling all the time, but why are you using a lowercase C in :Connect()?

1 Like

Oops, my bad. I wrote this on phone. I fixed it

1 Like

Avoiding wait() and why (roblox.com)

Already has been pointed out.

Uhh no it’s kinda irrelevant and it increases performance usage too.

It’s better off to use :Wait() if you’re not gonna do something within that function.

Instance:GetPropertyChangedSignal("Property"):Wait()

If you’re going to do something like change a value, then you’d connect it.

This was just an example. I’m not saying you should use connect than wait . Thanks tho you made me remember :wait() existed

Hi,
This should be in #help-and-feedback:scripting-support (I think, I’m sure).

Then why is stop using setasync in community resource category?

Umm sorry I am not a scripter I have no idea whatever you’re talking about.

Uhh sorry for ‘not using my brain’ but this is not a scripting category as far as I know.

Community Resources eg:

I’m pretty sure this category is for stuff you’re offering for the others.

Fine , changed the category I hate 30 ch ars limit

1 Like

repeat wait() until and while true do are fine if you break the loop as soon as some condition is met.

1 Like

How would I do this for variables?

I don’t understand what your scripting question is.

If this is not a scripting question it goes in #resources:community-resources or #resources:community-tutorials