GUI tweening help

Hello, it’s me again!
Alrighty, let me explain what is my problem is and what I’m trying to do.
So, I’m making a “News & Update” GUI and I want it to cycle between two things.
reference image
image
I want to tween to the right after 10 seconds, wait 2 seconds and then the second one will tween on back off after 10 seconds and then 1st one is back and it repeats.
Here is my script so far, any help is appreciated:

script
local news = script.Parent.News1
local news2 = script.Parent.News2

wait(10)
news:TweenPosition(UDim2.new(0.998, 0, 0.013, 0), "InOut", "Sine", 0.7)
wait(2)
news2:TweenPosition(UDim2.new(0, 0, -0.004, 0), "InOut", "Sine", 0.7)
wait(10)
news2:TweenPosition(UDim2.new(0.998, 0, 0.013, 0), "InOut", "Sine", 0.7)
wait(2)
news:TweenPosition(UDim2.new(0, 0, -0.004, 0), "InOut", "Sine", 0.7)
Where the script is placed

I also want to double check, that the script should work here.
image

Where’s the problem exactly? What part of the script doesn’t work?

1 Like

I want to know how to make it repeat.
I’m not the smartest, sorry if I’ve made no sense. :clown_face:

You can have a while loop to have it repeat.

1 Like

Repeat the whole process?
You can use for loop for that, to repeat it twice (not sure if you meant this tho)

local news = script.Parent.News1
local news2 = script.Parent.News2

for i = 1,2 do
    wait(10)
    news:TweenPosition(UDim2.new(0.998, 0, 0.013, 0), "InOut", "Sine", 0.7)
    wait(2)
    news2:TweenPosition(UDim2.new(0, 0, -0.004, 0), "InOut", "Sine", 0.7)
    wait(10)
    news2:TweenPosition(UDim2.new(0.998, 0, 0.013, 0), "InOut", "Sine", 0.7)
    wait(2)
    news:TweenPosition(UDim2.new(0, 0, -0.004, 0), "InOut", "Sine", 0.7)
end;

Alternatively, you can use while loops to repeat it infinitely as @COUNTYL1MITS suggested.

1 Like

Thanks, this was extreamly helpful!
I will try out the while loops too, but thanks your addition helps a bunch!

1 Like