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

My Tween Works Sometimes, Explanation or Syntax Correction?

Asked by 10 years ago

I have tried making a simple loading GUI, and it works MOST of the time. Here is the code:

fra = script.Parent.Frame
wel = fra.Welcome
game = fra.Game
looks = script.Parent.looks

wel:TweenPosition(UDim2.new(.25,0,.25,0),"Out","Quad",3)
wait(3)
game:TweenPosition(UDim2.new(.25,0,.35,0),"Out","Bounce",3)
wait(3)
looks:TweenPosition(UDim2.new(0,0,0,0),"Out","Bounce",3)
wait(3)
fra:TweenPosition(UDim2.new(1,0,0,0),"Out","Quad",3)
looks:TweenPosition(UDim2.new(1,0,0,0),"Out","Quad",3)
wait(3)
scrip.Parent:Remove()

The 'looks' variable sometimes doesn't move out of the screen and then doesn't delete, which makes me wonder.

1 answer

Log in to vote
1
Answered by
Nickoakz 231 Moderation Voter
10 years ago

Tweening is a complex service, The worst problem about it is that the true/false at the end does not work. Tweening might also take a little bit more time. So this might fix the problem. No one might even notice a difference. When one item is tweening, most likely it will glitch it if it did not stop tweening when another tweening is wanting to run.

fra = script.Parent.Frame
wel = fra.Welcome
game = fra.Game
looks = script.Parent.looks
wel:TweenPosition(UDim2.new(.25,0,.25,0),"Out","Quad",2.9)
wait(3.1)
game:TweenPosition(UDim2.new(.25,0,.35,0),"Out","Bounce",2.9)
wait(3.1)
looks:TweenPosition(UDim2.new(0,0,0,0),"Out","Bounce",2.9)
wait(3.1)
fra:TweenPosition(UDim2.new(1,0,0,0),"Out","Quad",2.9)
looks:TweenPosition(UDim2.new(1,0,0,0),"Out","Quad",2.9)
wait(3.1)
script.Parent:Remove() --Did you mean script.Parent?

For a full explanation. I think TweenPosition uses wait, so it might add 0.001 seconds to how long you want it to wait. This will work since the wait will wait a slightly bit longer and the tweens will move a little bit faster.

0
Thanks for that. ChrisFantasyHalo 10 — 10y
1
Make sure to mark my answer with a green checkmark. Thanks. Nickoakz 231 — 10y
Ad

Answer this question