Tween Service is very useful and important to me, and I really want to use it in many of my games. The issue I face when trying to do so, is the time it takes to remember how to use Tween Service, remember the format, type everything in correctly, and test it out.
Imagine using Tween Service on five GUIs just to make one simple animation. That would take so much time!
How do you all make scripting Tween Service faster, if at all?
Thank you!
You can make a module, for example if you wanna close an menu, usually it’s simple math and you could just call a function in the module, and yeah, like Open(menu) and Close(menu)
It depends on what you’re doing
I mostly don’t use the last 3 arguments in TweenInfo, I don’t even remember what they do, I always have them as 0, false, 0
.
Mostly it’s simple; and depending on what you’re doing you can just use a module and shorten your code, messagingService can also be useful;
Could you explain why messaging service would be useful? I’m not familiar with it.
Also, could you possibly direct me to any resources where I could learn more about modules? I’m not used to using them either.
However, this was helpful! Thanks.
I happen to have just the thing for you. I use this all the time because I can’t be bothered to memorize all of the details to tweening. Here’s a function you can use:
local T = game:GetService('TweenService')
function tween(o,t,l,s,d)
s = s or Enum.EasingStyle.Linear
d = d or Enum.EasingDirection.InOut
local i = TweenInfo.new(l,s,d)
return T:Create(o,i,t)
end
Here’s an example use case:
tween(workspace.Part,{Transparency=1},1):Play()
The variables are as follows:
tween(Object,Table,Length,Style,Direction)
Style and Direction use the Enum format, however both are optional.
Oh sorry LOL not MessagingService I meant CollectionService
Alright, thank you for your help!
How To Use Module Scripts this can be helpful about modules, also this could help optimize that function that, that girl sent you;
Interesting. I’ll certainly look at this and how it works.
Why is there no t, l, or o in the function that I can see?
It’s been a while, so sorry for the trouble.
Because you write that in yourself. I listed the kind of inputs it has along with an example.
I don’t know what you specifically want, but I have tweenservice simplified to 1 line.
game:GetService("TweenService"):Create(--Object to tween, TweenInfo.new(--Tween info here),{--Parameters here}):Play()