Humanoid Animation Replication

I’m creating my own custom characters. My current approach is to animate each character locally. So each client would handle its own and all other player character animations. This seems nice and buttery smooth with respect to responsiveness. However my problem is that this is obviously not replicated to the server. This is an issue because in my case I have things like swords that are welded to the character, and since they aren’t moving on the server I can’t accurately detect when the sword hits a player.

Does anyone know what Roblox does to make their animation replicate to the server while handling at least your player character’s animations locally? I assume they are based on the local animation script but I’m not sure how that’s being replicated to the server.

If the network ownership of your custom character is set to the Player, it should replicate as far as I’m aware.

part:SetNetworkOwner(Player)

1 Like

It is, which is why the character movement is buttery smooth. Animations aren’t physics based though are they? I don’t think they replicate.

You can modify the position of anything you own, even if it isn’t directly by physics, I’m pretty sure. It may be different when it comes to Motor6D’s or humanoids though.

After testing it in studio, I feel roblox probably sends animations to the server and back to everyone else to be played, at least for Humanoids. You could probably use TimePosition to try and prevent lag from making the animations unsynchronized across clients.

That would require all kinds of syncing time between client and server, with the addition of timezones, not to mention that lag isn’t exactly a constant. I suppose you could use tick() and determine TimePosition from there but the problem is that if I’m animating on the Server and the Client then the Server will take control. So TimePosition probably won’t do too much here. The main problem with running animations on the server vs client is that 0.1-0.3 second delay from the player’s connection.

Roblox’s animation script is local in characters which makes me think it’s probably something I need to do from the StarterCharacter folder. Maybe there’s something special about that but I’m unsure. I know that the animations need to be run locally for sure though.

Nothing special about StarterCharacter, you can replicate animations from anywhere.

And yeah, it would require a lot of syncing but I feel like this is what Roblox does.


I rotated my root motor’s orientation, and it doesn’t replicate which makes me believe roblox just sends animations to other clients. I don’t know for sure, though. Walking and everything looks normal on right side screen aswell.

The local animation script doesn’t use any hacky ways to replicate animations. That’s the internal job of the Humanoid instance. The script simply loads and plays the animation.

I personally don’t have any experience with custom characters so I don’t know why the animations don’t replicate for you.

Or maybe normal animations are never seen by the server? If that’s the case, just try connecting Touched or similar to the sword. It should work regardless if the server sees animations.

Okay, so fire up a test in studio. If you do that you’ll see that the animations play on both the server and client while actually being handled locally via the animation script.

I’m not suggesting there’s a hacky way to replicate animations. I’m more curious how Roblox is doing it. Maybe having the localscript in Workspace makes a difference? I dunno fellas.

A LocalScript’s parent wouldn’t cause it to replicate differently. I ran a test in studio and modifying the Motor6D’s didn’t replicate so I feel that roblox probably just internally sends animations to other clients to be played.

Hmm, any way to be sure of that? It doesn’t seem very conducive to making custom characters, and I’m certainly not the only one who has done it but it doesn’t seem like an issue for others… although even if it was an issue you wouldn’t see it as the player anyway.

I’ll continue to explore the issue and if anyone has any suggestions I’ll look into it and post my findings here.

1 Like

Not really a way to be sure, but Motor6D’s clearly do not replicate atleast on Humanoids, so roblox had to of done something in their Humanoid code which means each player probably plays the animation locally.

image

Player animations do replicate to the server.

It doesn’t matter if it’s the default character, or a custom character, if the character model has a humanoid and is the player’s character (can be viewed by the Player.Character property) the animations will replicate.

That certainly is not what I’m seeing. I tried setting the player’s character to the custom character from both the client and server. Neither seems to have any effect. Perhaps I’m missing something else?
So far I’m:

  • Setting the player’s character to the custom character
  • Setting NetworkOwnership of the custom character to the player
  • Animating from the client side in a local script.

You can’t set the Character property like that without getting complications. Simply place your character model in StarterPlayer and name it “StarterCharacter.” This will make you spawn as the custom character, correctly setting the Player.Character property

1 Like

You can’t set the Character property without getting errors. Simply place your character model in StarterPlayer and name it “StarterCharacter”

I’m setting the character property just fine with no errors. But I will try your second suggestion.

UPDATE: Your suggestion of putting the character into the StarterPlayer and naming it StarterCharacter seems to work. Thank you.

Not sure when they made it so you couldn’t set a Player’s character from the server though.

Out of curiosity, what if someone wanted to have multiple character models? I haven’t been able to find any doc on this.

What do you mean by multiple? Controlling two characters? or having a list of characters to choose from like many lego games?

Having a choice between many characters. I just want something more flexible than “Put it in StarterPlayer and name it StarterCharacter” because that’s just a bad design.

Yes, having a choice between many characters is definitely achievable with some scripting.

This is the only method that I am aware of, but there could be other, better methods.

One way to have multiple characters is to place a different character model into StarterPlayer and then call Player:LoadCharacter().

1 Like

Well that’s just about the most hacky thing I’ve heard all day.

1 Like