Which way can optimize game?

My game using many Tweenservices but it needs more “local” which can make lags

local tweeninfo = nil
local goal = {}
local tween = nil
tweeninfo = TweenInfo.new(~~~~~,Enum.EasingStyle.Linear,Enum.EasingDirection.In)
	goal = {
		~~~~~,~~~~~,~~~~~
	}
	tween = TweenService:Create(~~~~~,tweeninfo,goal)
	tween:Play()

Every scripts need tweenservice should have these system so now I thinking about Modulescript.
It can make tweenservice using only one script but many scripts will make this modulescript work in both server and client.
Modulescript should make about 10 tweenservices maximum at some moment.
Then will those tweenservices work well?
Or should I keep many scripts for tweenservice even if it can make lag?

1 Like

it depends on what you’re tweening, so far i’ve only had performance issues with tweening transparency of a basepart or anything in a viewportframe

You don’t really need that many tweenservices. You can just play the tween whenever you need it. If you’re referring to having many TweenInfos, what is the purpose of doing so?

You could use module scripts but there isn’t much difference, because using the function which plays the tween in the module script is equivalent to running a script.

If I do understand what you’re trying to say, you can use a module script and store the tween and whatever action under said function in your module script. Then when you need the tween, simply require the module script and play the tween through the function in that module script.