Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I shorten this?

script.Parent.Position = UDim2.new(0,0,0,0)
wait(0.01)
script.Parent.Position = UDim2.new(0,10,0,0)
wait(0.01)
script.Parent.Position = UDim2.new(0,20,0,0)
wait(0.01)
script.Parent.Position = UDim2.new(0,30,0,0)
wait(0.01)
script.Parent.Position = UDim2.new(0,40,0,0)
wait(0.01)
script.Parent.Position = UDim2.new(0,50,0,0)
wait(0.01)
script.Parent.Position = UDim2.new(0,60,0,0)
wait(0.01)
script.Parent.Position = UDim2.new(0,70,0,0)
wait(0.01)

I don't want the script this long. Is their a way to make it move from (0,0,0,0) to (0,70,0,0) on screen?

1 answer

✓ Accepted answer

http://wiki.roblox.com/index.php?title=TweenPosition_(Method) Take a look at this, tween-position basically allows you to enter a UDim2 and roblox will automatically make a smooth path to that location. In your scenario you could put:

script.Parent.Position = UDim2.new(0,0,0,0)
script.Parent:TweenPosition(UDim2.new(0,70,0,0), "Out", "Quad", 1)

This discussion is preserved as it was. New answers, comments, and votes are closed.