WHILE LOOP or GetPropertyChangedSignal()?

I KNOW me shouldnt have too many WHILE loops cus bad performance
but what about the other ONE?

example!

lightService:GetPropertyChangedSignal("ClockTime"):Connect(function()
   --you can CHECK time and do some cool stuff with that
end)
  • WHILE LOOP
  • GetPropertyChangedSignal()

0 voters

2 Likes

NEVER, ever, use while loops for checking a value. .Changed and :GetPropertyChangedSignal() exists solely for that. While loops should only be used for repeating certain tasks per n seconds.

THANK YOU
BUT is there a LIMIT for getproperty and changed?(how many times its OKAY to use it] [ i KNOW while loops have a ‘limit’ suggesting to use 3-4]

no, i don’t think so. they only fire when a certain property has changed, unlike loops which run for as fast as you want it

it depends on what you’re trying to do if you’re trying to spawn parts in a loop you shouldn’t have too many loops of them

1 Like

you SIR are AMAZING, i appreicate!!

so IF I want to change stocks prices every couple of minutes/seconds[not too quick tho] i should use
lightService:GetPropertyChangedSignal("ClockTime"):Connect(function()?

3 Likes

if you already have a loop that changes clock time there would be no reason to use this since you can just change stocks prices inside of the loop

2 Likes