Selective Animation Replication

For a side-project I am working on, I need to be able to selectively decide if I would like Character animations to filter or not. In other words, I would like all of the default animations conducted by a Character’s Animate script to replicate as usual, but I would like some custom animations I am playing to not replicate.

The main reason I need this sort of behavior is due to the complexity of the animations’ implementation. The animations have Markers that, when triggered, create/modify/destroy Parts–all changes that are not replicated. Therefore, I need each client to play the animation on their own. However, since the Character’s client is also playing the animation, and it is replicated automatically, all other clients see the animation start and then restart (i.e. they see the animation played twice).

Many topics have been made that have similar problems, but the solutions given are less-than-desirable (for my situation):

  • One solution was to simply not play the animations on the other clients. Obviously, this won’t work in my case.
  • Another solution was to re-create the Character’s Animator object, which completely disables replication. Were I to go with this, I would have to override the default Animate script with a modified implementation that instructs the server to replicate avatar animations–another not-desirable solution, as this will prevent any Roblox updates to the Animate script from being applied to my game (and it introduces some problems with loading a Character’s avatar animations).
  • An additional solution was to play the animations on the server. This would introduce noticeable latency between the client triggering the animation and the client seeing the animation (i.e. poor user experience).

The ideal solution would be a boolean property of AnimationTrack that toggles automatic replication (e.g. AnimationTrack.AutomaticReplicationEnabled = false). However, this obviously does not exist. Does anyone know of a clean solution to this problem?

1 Like

why not play the animations on the client like you said and do the part generation/destruction on the server when the animations is played like this

local humanoid = --a character's humanoid here
            --part generation here or whatever adittional effects

and i know that there may be some lag between the animation being client and the effects on server due to latency issues, however, that what is most games do. For example, i know that this is how dungeon quest most likely play there animations because when i was playing on a bad connection there was some lag between the part generation while the animation was played instantly, however, in my opinion it does not really make the game experience horrible, it just seems that way to you because you want your game perfect but in reality every game is gonna have bugs or glitches when latency issues come into concern.

You are entitled to your opinion, but saying my problem “is not a real problem” is not a solution. Here is why I cannot allow any sort of latency in some animations:

One of the part effects that I am trying to do is re-welding a Character’s sword off of their back and onto their hand. Were this to have any sort of latency, it would be very noticeable (i.e. the sword jumping off of their back into their hand way too late in the animation), and, considering how common of an action this would be, allowing latency in this area is simply out of the question.

then you can just use remote events to first inform the server of the effect then fire a remote to all other clients to also do the effect, but it can still have latency issues but they would just be on the other players, but not on the not client , and i wasn’t saying your problem is a real one but no system is gonna be perfect, but doing this should work decently.

1 Like

Maybe I didn’t describe my problem very well. What you described is my current implementation. The problem is that all other clients are seeing the animation twice due to the automatic replication of animations on a client’s Character. Here is an outline of the problem:

  1. The client triggers the animation, playing it on its own character, and instructing the server to show the animation on all other clients.
  2. The server automatically replicates the animation the client played, and tells all other clients to play it as well (due to the instruction in step 1).
  3. All other clients see the automatically replicated animation, and then shortly receive instructions from the server to play that same animation again (bad, because they see the same thing twice).

I want to stop to the server from doing that automatic part on only select animations, as some animations are triggered by Roblox’s scripts.

thats not what i mean, you would play the animations and the effects locally, and then you would use remote events to replicated the effects like part generation on other clients, not the animations itself, apart from that there are no other methods because characters are animated through the humanoids and not animation controllers

Again, that would introduce very noticeable latency. After many years, my personal experience has showed that common visual latency in animations can be the difference between a good user experience and a great user experience. It is completely okay for you to disagree; just different ideologies on this kind of thing.

Anyways, I have decided to just go with overriding Roblox’s Animate script with a custom implementation that manually replicates everything. I’ll simply have to keep track of when Roblox updates their Animate script. I’ve settled with the fact that there is probably no other way around it.

yh your most likely gonna have to do that because most other games I’ve played with intense animations do have the delay issue. Good luck though in making your custom animate script hope it turns out great :slight_smile:

1 Like