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

How can I shorten this? [closed]

Asked by 10 years ago
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?

Locked by TheMyrco

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

1 answer

Log in to vote
1
Answered by 10 years ago

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)
Ad