regexman
(reg)
October 27, 2021, 2:08pm
#1
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
HedTB_Dev
(HedTB_Dev)
October 27, 2021, 2:13pm
#2
Yeah this is much better than polling all the time, but why are you using a lowercase C in :Connect()
?
1 Like
regexman
(reg)
October 27, 2021, 2:21pm
#3
Oops, my bad. I wrote this on phone. I fixed it
1 Like
regexman
(reg)
October 27, 2021, 2:28pm
#5
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.
regexman
(reg)
October 27, 2021, 2:31pm
#7
This was just an example. I’m not saying you should use connect than wait . Thanks tho you made me remember :wait() existed
OhLordiez
(monsterZ)
October 27, 2021, 2:43pm
#8
Hi,
This should be in #help-and-feedback:scripting-support (I think, I’m sure).
regexman
(reg)
October 27, 2021, 3:05pm
#9
Then why is stop using setasync in community resource category?
OhLordiez
(monsterZ)
October 27, 2021, 3:07pm
#10
Umm sorry I am not a scripter I have no idea whatever you’re talking about.
OhLordiez
(monsterZ)
October 27, 2021, 3:11pm
#12
Uhh sorry for ‘not using my brain’ but this is not a scripting category as far as I know.
Community Resources eg:
esta muy bueno gracias por informar
I’m pretty sure this category is for stuff you’re offering for the others.
regexman
(reg)
October 27, 2021, 3:14pm
#13
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
Lleventyate
(Sevtenonuhnder)
October 27, 2021, 5:29pm
#15
How would I do this for variables?
batteryday
(batteryday)
October 27, 2021, 5:37pm
#16
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