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

[Solved] What is a Tween?

I am not that clear on what these values mean.

They are all numbers but I don't really know what they do. Can you explain what they mean by looking at these variables? --The reason why I have variables is this is how I can learn on what the numbers mean.

local a = ? --Comment here
local b = ? --Comment here
local c = ? --Comment here
local d = ? --Comment here
local e = ? --Comment here

Frame:TweenSize(UDim2.new(a, b, c, d), "Out", "Quad", e, false, nil)

I don't understand Gui tweening that well and I need a basic explanation on how things work in a tween.

Thankyou.

2 answers

✓ Accepted answer

Tweening is smooth movement and resizing of Gui's. Tweening in roblox is basically a way to beautify your GUIs, and create a more pleasing graphical appearance. Tweening can be used to resize GUIs, move GUIs, or both.

Scripting the Gui to tween your you need to use either "TweenSize" or "TweenPosition" - That is the obvious part.

Frame:TweenSize
Frame:TweenPosition

The next part is WHERE you want it to END!!

(UDim2.new(0.5, 0, 0.5, 0)

So the code will look like this.

Frame:TweenPosition(UDim2.new(0.5, 0, 0.5, 0))

BUT the script needs to know WHICH way it will travel. Usually you use "In" or "Out" but you can use "InOut"

So the script will look like this

Frame:TweenPosition(UDim2.new(0.5, 0, 0.5, 0), "In",)

BUTTT the script will also need to know what STYLE you want it to move in. (Normal paced to fast at the end) and stuff like that. there are lots of different ones you can use but my favourite are "Bounce" and "Quad"

The script will look like this

Frame:TweenPosition(UDim2.new(0.5, 0, 0.5, 0), "In",  "Quad")

The script needs to know how LONG it will travel.

Frame:TweenPosition(UDim2.new(0.5, 0, 0.5, 0), "In",  "Quad", "10") -- 10 is the time spent changing in seconds

Last this is not extreemly important. Leave it as false or true.

Frame:TweenPosition(UDim2.new(0.5, 0, 0.5, 0), "In",  "Quad", "10", "False") 

I hope I helped out :) Thumbs my upppp :D

9 comments

0

This helped me a lot! Thank you so much!!!!!!!!!!!!

2

'Tis Ok. I enjoyed writing it. :D

0

Wait so I can add multiple lines to do one tween session?

2

I am not sure but this -- Frame:TweenPosition(UDim2.new(0.5, 0, 0.5, 0), "In", "Quad", "10", "False") -- was the final product.

0

Oh okay. :)

1

While it is possible to use a string for the time, it is best to use an integer. I recommend removing the quotes from 10. You should also mention that it is ten seconds.

0

Frame:TweenPosition(UDim2.new(0.5, 0, 0.5, 0), "In", "Quad", 10, "False") --Like this?

2

yus exactly :)

0

One important question, Where it says true or false, would I need to trigger that to true when its time for it to tween or do I leave it both true? For close an opening.

A tween is just a smooth transition. The first argument to TweenSize is a UDim2 value, which is the size you want to tween to.

In case you don't know what a UDim2 value is, here's a simple definition: It's a value which is used in ROBLOX to define GUI properties. If we take the following example: UDim2.new(a, b, c, d), then:

  • a is X Scale
  • b is X Offset
  • c is Y Scale
  • d is Y Offset

Scale is percentage of the parent (or screen if no hierarchical superior GuiObject) (0 through 1, meaning you use decimals) and Offset is pixels.

1 comment

1

This also helped me a lot too! Now I know what the X and Y values are. :)

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