How to leave a parameter blank in TweenInfo?

Hi, is it possible to pass through a blank parameter in TweenInfo so that parameter will be set to the default??

This is kinda what I mean but this doesn’t work
image
Is it possible, or do I have to type the parameter each time I decide to use TweenInfo but only modifying the Time and EasingDirection parameters??

Thanks

1 Like

Hmm… I don’t think you can (dont take my word on that im no pro scripter, however i tried nil, ... it only occurs errors) but the default TweenInfo is;

EasingStyle: Quad
EasingDirection: Out
RepeatCount: 0
Reverses: false
DelayTime: 0

1 Like

You can’t leave arguments between 2 arguments as you said but you can leave the end ones. So:
:white_check_mark:

TweenInfo.new(1)

:negative_squared_cross_mark:

TweenInfo.new(_, Enum.EasingStyle.Linear)

:negative_squared_cross_mark:

TweenInfo,new(1, _, Enum.EasingDirection.Out)

The best way to approach this would to be to create a base function which would inherit the same features as the TweenInfo.new() function, but remove a variable:

local function TweenInfo2(Length, EasingDirection): TweenInfo
   return TweenInfo.new(Length, Enum.EasingStyle.(style), EasingDirection)
end 

But worse comes to worst, just add the parameter just in case.

Set the Parameter as nil, however doing this will just set it another value, which for EasingStyle will default to Quad

I highly doubt you tested this before posting this answer LOL.
fyi it errors :slight_smile:

1 Like

Whoops, It was actually setting the value to 0 that did that, but anyway.


local t = TweenInfo.new()

t.Time = 2
t.EasingDirection = Enum.EasingDirection.In

Here TweenInfo will have specific set values, you just modify them after creating the TweenInfo


TweenInfo.new(x, 0, y, z)

Set your Data on the TweenInfo while ingoring the one you want want using 0 which will set it as Linear for EasingStyle, however for the boolean, you cant use a number.

  1. Errors as properties on TweenInfo are readonly.
  2. 0 does NOT make it ignore it and instead will pick the enum with the number you pass.
1 Like

Setting the EasingStyle/EasingDirection to 0 actually sets it to the corresponding enum that has the value 0. For EasingStyle, this is Linear, and for EasingDirection, this is In.

1 Like

Please read my post correctly as i did not state that.

I need to sleep, my brain does not work today