Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do l loop a TweenPosition?

Asked by
Probix 80
7 years ago
Edited 7 years ago

I learned how to use TweenPosition and I decided I wanted my Gui to loop infinitely.

But...

function ZipOnThrough()     
    while true or false do      
            script.Parent:TweenPosition(UDim2.new(0, 893,0, 0), "Out", "Quad", 4, true)
                wait(4)
            script.Parent:TweenPosition(UDim2.new(0, 0,0, 0), "In", "Quad", 4, true)
    end
        end


script.Parent.MouseButton1Click:connect(ZipOnThrough)

It doesn't work. It would just go to the coordinates "0, 893,0, 0" but then it would just stop. I would really appreciate the help.

0
You did not add a wait() after the second tweenposition. The second one did not have time to complete. CodeSponge 125 — 7y

1 answer

Log in to vote
1
Answered by 7 years ago
function ZipOnThrough()    
    while wait(4) do     
         script.Parent:TweenPosition(UDim2.new(0, 893,0, 0), "Out", "Quad", 4, true)
        wait(4)
        script.Parent:TweenPosition(UDim2.new(0, 0,0, 0), "In", "Quad", 4, true)
         end
    end
script.Parent.MouseButton1Click:connect(ZipOnThrough)
0
Thank you very much! Probix 80 — 7y
Ad

Answer this question