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

How do I reverse this sliding function?

Asked by 10 years ago

I have a surface gui that slides across a screen from right to left, but I want it to slide from left to right. Here is the script:

local images = {script.Parent.TextLabel}

while wait() do 
    for _,v in pairs(images) do
        local temp = v.Position.X.Scale
        if (temp <= -v.Size.X.Scale) then
            temp = 1.0
        end
        v.Position = UDim2.new(temp - 0.01, 0, 0.4, 0)
    end
end

How do I reverse the direction it slides in?

I have tried making (temp - 0.01, 0, 0.4, 0) into (temp - -0.01, 0, 0.4, 0), and it worked, but only for the first time.

Answer this question