Hey, I’m a starter scripter going into variables, etc I’ve already have a good experience with tweeting but I want to maintain my scripts a little bit better.
I want to have a tween variable (e.x :
local tweenInfo = TweenInfo.new(0.2, Enum.EasingStyle.Quint, Enum.EasingDirection.InOut)
I’m taking a guess that the “0.2” is the Duration time which I already have as a variable separate.
local TweenDuration = 0.2
How can I only put the tweeting info such as Out & Quint?
This link is very helpful, if you scroll to the bottom it has some good code samples.
local tweenInfo = TweenInfo.new(
2, -- Time
Enum.EasingStyle.Quint, -- EasingStyle
Enum.EasingDirection.Out, -- EasingDirection
-1, -- RepeatCount (when less than zero the tween will loop indefinitely)
true, -- Reverses (tween will reverse once reaching it's goal)
0 -- DelayTime
)
To change the easing style, just change the second parameter to whatever you want. If you are going to change the easing style, you have to define the time parameter also, but you don’t have to define the other parameters.
You can’t supply the Tween easing style and easing direction without also defining the time/duration. As far as I’m aware, Lua has no native support for passing parameters out of order.
You can store each easing style/easing direction of your preference in separate variables. But I’d just rewrite the TweenInfo for each unique tween you do (unless the same set of parameters frequently repeat ~ in which case you could have a few TweenInfo variables that are used to create multiple tweens).
local Time = 0.2
local Style = Enum.EasingStyle.Quint
local Direction = Enum.EasingDirection.InOut
local tweenInfo = TweenInfo.new(Time, Style, Direction)