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

TweenPosition not working?

Asked by
Uroxus 350 Moderation Voter
8 years ago

I'm not sure if I'm being stupid or if I'm doing it wrong, but the first part works yet when it gets to the second wait, nothing happens. There are no outputs...

wait(2)
script.Parent.Frame:TweenPosition(UDim2.new(0.4, 0, 0.2, 0),"Out", "Linear", 4, false)
wait(1)
script.Parent.Frame:TweenPosition(UDim2.new(1.4, 0, 1.2, 0),"Out", "Linear", 2, false)

Haaalp

1 answer

Log in to vote
1
Answered by
M39a9am3R 3210 Moderation Voter Community Moderator
8 years ago

Problem

The problem is you have the override argument set to false (the fifth argument). This means the first TweenPosition will continue to go until it is done. The second TweenPosition will not be able to take effect until the 4 seconds you defined (fourth argument) is up. Since the second TweenPosition was requested at a time the first TweenPosition was not done, that line will not take effect.


Solution

There are two solutions to this problem,

  1. Have a longer wait.
  2. Set override to true.

Personally I go for the longer wait, since I prefer to see the full animation.


Final Script

wait(2)
script.Parent.Frame:TweenPosition(UDim2.new(0.4, 0, 0.2, 0),"Out", "Linear", 4, false)
wait(4)
script.Parent.Frame:TweenPosition(UDim2.new(1.4, 0, 1.2, 0),"Out", "Linear", 2, false)

Hopefully this answered your question. If so, do not forget to hit the accept answer button. If you have any questions, feel free to comment below.
Ad

Answer this question