Well we all know that too much while wait() do or while true do can cause crashes, which we don't want those.
Now I learned that if I want to change a text to a certain value then a better way then using loops is doing the .Changed event. But what if I'm trying to continuously Tween a frame? Is there a better way than looping?
This is my script;
local NB = script.Parent
while true do
wait(0.00000000000000000000000000000000001)
NB:TweenPosition(UDim2.new(0, 840,0, 220),'In','Sine',0.5)
wait(0.00000000000000000000000000000000001)
NB:TweenPosition(UDim2.new(0, 840,0, 240),'Out','Sine',0.5)
end
If there is a better way then looping for forever tweens then please help. I need to learn a better way then just looping. It causes crashes and it's annoying.

3 comments
While wait() do shouldn't be causing you crashes. While true do should cause crashes if you don't have a yield inside your looped code. Personally I would use a repeat (code here) until loop instead though as you can stop it with a certain condition. Be sure to add a yield though.
not necessary to do wait(0.00000...ect1) just use wait()
I feel like wait() takes longer