Fighting lag from tweening on the server

I recently released by first game and I’m running into some major issue with lag. The game’s main focus is to level up and unlock magic skills, but these magic skills are very laggy and I believe it is due to all the tweening I am doing on the server.

The process for using a magic attack is simple. A local script detects the input, fires a remote event, and the server handles everything else, including special effects- the source of the lag. I would like some feedback on how I should go about decreasing lag by tweening on the client.

I did some research and came across the module script called “TweenServiceV2” by SteadyOn but unfortunately this module does not support using Tween.Completed, and most if not all of the magic attacks rely on that event to start the action.

I would really like for some feedback on how to combat this lag problem. Should I try to edit TweenServiceV2? Should I redo all magic attacks on the client?

I do have my own module for this, although why cant you just wait the tween time?

Thanks for the reply. If you mean that I should just wait the tween time instead of using .Completed then yes I could. But if I were to do this, I would have to search for every time I use the Completed event and add a new thread so that wait would not yield the script. So I would like to keep my options open before devoting the time to do this.

Your best option is just to make a custom client tween. I recommend using remote events and just using the .Completed functions on your original client script.

Tween on the client. After the server receives a request to perform some sort of tween, instead of doing it on the server, simply send an event to all clients telling them that a tween needs to be done for some parts.

If you tween on the server, the part movements will only be replicated at the network replication rate. If there is network latency jitter, the parts will subsequently be jittery in their movement. Doing it on the client will ensure that visuals are network agnostic.

1 Like

Hello, I am running into practically the exact same problem as you except for the fact that i am tweening on the client and it still lags the whole server. Have you found a solution to this that works?

Hi,

It’s possible something else is causing the lag. Ever since I started tweening on the client, I haven’t had any lag problems. Maybe its a matter of too many parts being tweened or a tween being repeated too many times?

1 Like

Nvm, I have learned that having a random humanoid in the workspace causes intense tweening and resizing lag.

1 Like