Ragdolls looking laggy on other clients

so I am making a ragdoll system for a game I’m working on and a problem that I am encountering is when I ragdoll its nice and smooth for me but for other clients it’s not, so my client sees it as nice and smooth but the other players see me lagging, the main ragdoll script is a module script with a server script as the activator and a local script as the user input detector so it goes Local > Server > Module, below are some videos of the problem, any help is appreciated, thanks in advance.

my Client:
https://gyazo.com/1647e77456cd0d78ed02e44f6cd8a909

Other Clients:
https://gyazo.com/c96584f28768816f4911a61fab21abaa

3 Likes

WHAT?: Roblox networking is based on authority system.
Authority system is a part of networking, which manages ownership of every object in a hierarchy. Naturally player’s ownership is set to the client who controls the player, that’s why when you move, you basically never lag, but when you watch other players move, they sometimes lag. This can be simply tested by making a race with players from same starting point, you’ll see yourself pretty much in front of everyone, but someone else sees himself in front of you.
Objects which are not managed by any of a client and have physics applied have got variable ownership, which depends on who is closest to the object. So basically the closest player owns a part which is affected by physics. However any part, which is static is always managed by the server, if not defined otherwise (eg. ServerScript sets the ownership to player).

WHY?: And finally, the reason why it looks laggy to other players is that they don’t own your player model, and so they must wait for the server to send them the information about your state (position, velocity, …), and these informations are mostly sent using Unreliable UDP protocol, which doesn’t guarantee that all data will be received and in the correct order. This protocol is mostly used for values, which are often updated and need to be synchronized.

HOW?: The solution to this can be tricky I believe, but could be solved by managing the position and velocity of the player on client-side for every player. This means that when player jumps, the client sends RemoteEvent to the server that the player jumped, the server sends RemoteEvent to everyone else, that the player jumped and so, every client which received this message will set the velocity and animation of the player from their side. RemoteEvent is very nice in this solution, because it runs on Reliable protocol, which guarantees that the data which are sent will be received by the other end and in the correct order.

Good luck with that!

what service would i need to use for the other clients to know about the jump?

Create object of type RemoteEvent in ReplicatedStorage, and use this.
There is good Roblox documentation about the remote messages Remote Functions and Events

1 Like

so i just use remote event to send messages to the server?

Hate to necropost but were you ever able to solve this problem?

in the end i sorta gave up on trying to make my own system work and used this one instead which is a module made by @CompletedLoop , it is amazing and i whole heartedly recommend it:

however it is R6 only so if you need R15 then im afraid this might not work for you

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.