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

How do you reverse this?

Asked by
NotSoNorm 777 Moderation Voter
10 years ago

How would I reverse this Tween so it goes back to the position it was before it was clicked.

bin = script.Parent

function Clicked()
    script.Parent.Parent:TweenPosition
    (UDim2.new(0,0,0,1,0),"Out","Linear",1,true,nil)


wait(3)

bin.Parent.Visible = false

end

bin.MouseButton1Down:connect(Clicked)
0
Why do you have 5 values in the UDim2? jav2612 180 — 10y

1 answer

Log in to vote
0
Answered by
jav2612 180
10 years ago
bin = script.Parent
original = bin.Parent.Position
out = false

function Clicked()
    if out == false then
        script.Parent.Parent:TweenPosition(UDim2.new(0,0,0,1,0),"Out","Linear",1,true,nil)
        out = true
    else
        script.Parent.Parent:TweenPosition(original, "Out", "Linear", 1, true, nil)
        out = false
    end
end

--[[ I'm not sure where you want to put this stuff....
wait(3)

bin.Parent.Visible = false

]]

bin.MouseButton1Down:connect(Clicked)
Ad

Answer this question