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

Why does this go into a corner instead of going straight up?

Asked by 6 years ago
wait (11)
while wait() do
script.Parent:TweenPosition(UDim2.new(0,0,-1,0),"Out","Bounce")
end

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

The error is that your are not taking into account of the Original Position of the Gui i.e the xScale and the xScale of the script.Parent

For example!

A GUI with position of 0.5, 0, -1, 0

When you put in the following code script.Parent:TweenPosition(UDim2.new(0,0,-1,0),"Out","Bounce"), you are stating that the frame go to the 0, 0 position, rather than inputing the actual xScale position. What this means is that since our example has 0.5, instead of staying in 0.5, it is going to transition to 0. We do not want that. So here is a simple fix.

Simple Fix

wait (11)
while wait() do
script.Parent:TweenPosition(UDim2.new(yourScriptParentXScalePositionGoesHere,yourScriptParentYScalePositionGoesHere,-1,0),"Out","Bounce")
end

If the code is cut off, hover over to the codeblock and select the top icon (View Source) then take a look at the code.

[EDIT V2]

The tweenservice feature takes in more arguments than you are using. You really don't need a while true do loop there

EX:

GUI:TweenPosition(UDim2.new(1, 0, 1, 0), "Out", "Quad", 3)

the 3 after the "Quad" is the amount of time it takes for the tween to happen. This means that you do not need to loop the tween service.

TweenService Wiki

Also you said it was going fast, play around with the number and change it to your desire.

Have a lovely day of coding
0
Ok it went up but it went up so freaking fast how do i slow it down? ANDREW50060 1 — 6y
Ad

Answer this question