✓ Accepted answer
The missing element which is causing the delay is that the tweening waits until it reaches the exact position, to be able to tween again.
TweenPosition() takes six parameters:
Parameter 1: End position as UDim2
2: Easing direction (which you have indicated as "InOut")
3: Easing style ("Quad", "Sine", "Elastic" etc.)
4: Time (The amount of time it takes to do the transition)
5: Override (Boolean value, if set to true = it has to reach its End position before it's
able to start another transition)
6: Callback function (Will return whether the tween will be able to start a transition)
To be able to fix this problem, you would want to set the Override value to true when you call TweenPosition() to true since you do not want the program to wait until the End Position is reached to execute another transition.
So the code will look something like this:
local fight = script.Parent
while true do
fight:TweenPosition(UDim2.new(0.5, -200,0.5, -80), "InOut", "Quad", 1.5, true)
wait(1)
fight:TweenPosition(UDim2.new(0.5, -200,0.5, -60), "InOut", "Quad", 1.5, true)
wait(1)
end
Hope this helped!
2 comments
You don't have the argument "override" set, which is set to 'false' by default. This means that if, while it's moving, it is asked to tween to somewhere else, it will change its current task and move to the new place, if its set to true.
http://wiki.roblox.com/index.php?title=API:Class/GuiObject/TweenPosition