What I assume the issue is I’m using a slightly modified Roblox animation script (not a localscript) and it’s creating lag between when the server moves the NPC and then the client sees it (my Studio is set to simulate around 800 ping for testing reasons).
If I’m correct the fix would be to handle the animations on the client, but I’m not sure if that’s correct or how.
This could be caused by Server lag. Although you may not experience lag, the server can when you are not. It seems like the NPC lags when it gets close to the elevator. Is there something in the elevators scripts (if there are any) that may be lagging the server?
You should look for Output overloads. Sometimes, if code gets stuck i a loop with a print statement, the print statement would be firing 255,000 times a second. So make sure that is not happening. Also make sure that there are no left over “Humanoid” Instances in the Workspace. Sometimes, if you delete a Dummy, the Humanoid Instance can get stuck in the workspace. This would cause an immense amount of lag when RayTracing occurs.
You should also run the animation on the client. This makes it so if one client has 20 ping, and another client has 800 ping, It matches with the movement of the NPC.
As I said in the original post my Studio is set to simulate 800 ping. This is the root cause of the issue: high ping. I’m trying to polish it so people with high ping doesn’t have to deal with the visual lag. Players with better ping would also benefit as it would look smoother.
Also in the original post, I mentioned that, yes, I am aware that running it on the client will be smooth. I just need to know a good method.
Although I do not usually animate, I am pretty sure it is a good method to do it on the client.
Not every player needs to see the exact thing everyone else sees (ie. Every player does not need to be matched up the exact time and place the NPC takes a step… if that makes sense)
Yep, if the player lags/looses connection with the server, server scripts won’t work for that person, while local scripts work locally, so it doesn’t matter if they player is disconnected or not.
As I’ve said 2 times before, I know that handling the animations on the client is the way to fix the laggy animations. I just need to know the method of doing this.
For those that are seeing this topic afterwards and need help, I suggest to have a client script connect to whenever the NPC needs to be seen and have it load all of the animations and and detect when they need to be played there so that the animations will be accurate to whatever the client is seeing.