Create non-laggy animated skins?

Hi, so I currently have a system that does this but it’s extremely laggy even when done on the client.

		local function Applyandreturn()

			local Texlist = {}
			for iP , vP in pairs(model:GetChildren()) do

				for i = 1, #Enum.NormalId:GetEnumItems() do
					local Texture ='Texture', vP)

					Texture.Face = Enum.NormalId:GetEnumItems()[i]

					Texture.Texture = texture

					table.insert(Texlist, Texture)


			return Texlist

		if RarityToNumber[rarity] >= 5 then

		else  -- static skin / animated above^

The Tweening part is likely causing lag because it is Tweening over 30- 60 different textures as they have to be applied to each face. I’ve seen other games get away with this in performance because it only does it to one part. However, our weapons consist of many. I’m wondering if there was a way to animate said textures without causing lag. I’m currently running an RTX 3080 and a ryzen 9 5900x and losing up to 400 frames/s when the animated skin runs; I could only imagine what this will do to lower-end computer’s performance.

-thanks in advance for any help!

If your game is “Lagging” of which is network performance being lowered, I would recommend preloading these textures with ContentProvider before using. If your game is truely “loosing frames” then I would pay extra attention to why all your client code; that your probably running every frame needs to be somewhat optimized. In the above example I see that you use pairs to iterate over the parts of the model, this is sort of an anti-pattern for client driven code. Instead: replace pairs with next of which next, is faster. Remember to use next when you are dealing with client rendering code.

For your tweenservice problem, you should be able to tween a good amount of things on the client, so it might not even be tweenservice. Check your code for memory leaks and use debug.profilestart() to benchmark what the tweens actually take up performance wise.

I hoped this helped.