Allow TweenInfo.new to accept alternate values for enum parameters

Currently, if you want to make some simple tweeninfo, you’ll have to write something like this:

TweenInfo.new(1.2, Enum.EasingStyle.Back, Enum.EasingDirection.Out)

This, however, takes time to write out and can be done quicker!

TweenInfo.new(1.2, "Back", "Out")

My proposal is to allow the TweenInfo constructor to figure out the proper EnumItem from alternate values being either a string or integer value, just like how GuiObject:TweenSize/Position/SizeAndPosition works.

17 Likes

Support this, would be so useful! (:

Ohh, I just tried using string values in TweenInfo and I wasn’t sure why it was erring. Support.

I have no say in whether this happens or not…But literal strings and hardcoded number values? Oh no, please no. Constants and enums are almost always the preferred method.

5 Likes

The strings are just as valid as giving the full representation - the only case where it breaks is when the enum item is removed or renamed, in which case the full path is just as well invalidated.

As described in OP, I want to get things done faster, without clicking tab three times for each enum item I’m looking for, if I already know the name of it. I might not have a whole lot in my script, so defining variables at the top for single-occourence values in a 10-liner script seems like wasted time and effort to me.

I do agree with the number values, as that was suggested more as an inclusion to make it work like the old tween method did.

2 Likes

Support, I like writing a string more than an Enum lol

Sorry for the necrobump, but I feel this is interesting for some degree of uniformity between TweenService and the UI-related TweenPosition/TweenSize/TweenSizeAndPosition (which was already hit badly by the reversal of the arguments. I often end up mixing style and direction and wondering why my code isn’t working).

1 Like