I think its kind of basic concept. You've seen it in most popular games on the front page, but how would I do it? I tryed doing it with TweenPosition
or TweenSize
but it never works out so here is the following code that doesn't conduct the way I wanted
for i = 1, 2 do wait(.1) script.Parent.GradientDownwards:TweenPosition(UDim2.new(0, .025, 0)) script.Parent.GradientUpwards:TweenPosition(UDim2.new(0, .025, 0)) end
Sure it works, but I don't understand whats going on I change the numbers nothing happens decides the Vector3
thing at the end of the UDim2
thing. So can someone give me an understanding towards GUI movement or size?
Tweening a gui is just a way to make your gui slide or change size smooth and easily. They can either be changed by TweenPosition, TweenSize, or both with TweenSizeAndPosition
With tweening, you don't need to use a for loop, or a while true do loop. The Parameters that you put in basically sets up the loop for you.
Now TweenPosition needs 6 Parameters, the first argument is required. The Parameters are
endPosition Type: UDim2 Required easingDirection Type: EasingDirection Defaults to: Enum.EasingDirection.Out easingStyle Type: EasingStyle Defaults to: Enum.EasingStyle.Quad time Type: float Defaults to: 1 override Type: bool Defaults to: false callback Type: function(TweenStatus) Defaults to: nil
(from the wiki)
So for example, this would look like
Gui:TweenPosition(UDim2.new(0, 14, 0, 14), "Out", "Quad", 1, false, nil)
From my personal use, TweenPosition is the one you will be using the most. But for everyone that is different.
TweenSize allows you to change the size of the gui. TweenSize has the same Parameters as TweenPosition
For example, it would look like
Gui:TweenSize(UDim2.new(0, 14, 0, 14), "Out", "Quad", 1, false, nil)
Now TweenSizeAndPosition does both of them at the same time.
The only change in Parameters is that they require both endposition and end size
so it would look like
Gui:TweenSizeAndPosition(UDim2.new(0, 15, 0, 15), UDim2.new(1, 0, 1, 0), "Out", "Quad", 1, false, nil)
Basically all. Here is a link to the wiki that I used (because im a scrub and forgot) link
this might be a little overboard. the fix to your script is
script.Parent.GradientDownwards:TweenPosition(UDim2.new(0, .025, 0, 0)) --the rest will default, you might need to fix the values for the UDim2 script.Parent.GradientUpwards:TweenPosition(UDim2.new(0, .025, 0, 0)) --the rest will default, you might need to fix the values for the UDim2