Insane stutters when changing character's bodycolor

I’m working on a zombie infection system, however i noticed recently, that when the script(server side) changes the bodycolor of a player, the game stutters(on client side).
I checked the microprofiler and all i saw at the frames when the color was changed were 2 long lines, “RenderJob” and “Worker”.
I know that this is causing the issue, because when i removed the part of the code that changes bodycolor, the stutter disappeared completely.
This is very annoying because when someone is infected you lag every second(as the infection progresses) and it makes the game kinda unplayable.
Images:


This is the part of the code that changes the bodycolor.

2 Likes

I dont think theres enough information to work with here. How often is this code called? Can you show more code

1 Like

Have you tried using baby oil?

4 Likes

Could you try using tweenservice instead of lerping?

This part of the code runs every second(its a for i = 0, 100 loop with task.wait(1))

1 Like

I will probably change it so it uses tweenservice instead of lerp tomorrow