Using many repeat loops for tweening. Would it cause problems?

so I’m tweening most of my UI properties using repeat loops.

examples:

repeat task.wait()
	TextLabel.BackgroundTransparency -= 0.04
until TextLabel.BackgroundTransparency <= 0.7
repeat task.wait()
	TextLabel2.TextTransparency += 0.1
until TextLabel2.TextTransparency >= 1
repeat task.wait()
    TextButton.TextStrokeTransparency += 0.02
until TextButton.TextStrokeTransparency >= 1

I know I can use tweenservice for that but repeat loops look more readable and are easier to work with.

For now it seems to be working, but are there any possible problems this can cause?

It’s less readable and scalable, both in response to frame inconsistency and more complex interpolations and interactions. There’s no need to reinvent the wheel; just stick to tweens

1 Like

Not really. So long as you aren’t spawning more than is reasonable and you know the loops will end at the times you expect. You effectively created your own tween.

I would still recommend tween service though because it’s pretty standard and can handle sending a conflicting tween. You could technically with your current approach lock multiple tweens into a fight since they don’t run independently and aren’t able to overwrite each other. But you can of course solve this problem yourself. Or it’s not even a problem if you are sure you’ll never dispatch competing tweens.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.