Hey developers, sorry if this in the wrong category. So I’ve been working with animations and their GetMarkerReachedSignal events, and I’ve been using remotes to replicate effects when certain markers are reached in animations. However, I’ve been struggling with trying to get some effects sync up with the animations that replicate to the server automatically from the client, and I’m wondering I should refactor parts of my code to be more consistent. The problem is this: When I run an animation on the client and then display some sort of particle, sound, or other effect based on a marker being hit, the effect operates how it should be. The effect is shown by firing a RemoteEvent at the marker, which then replicates the effect to the rest of the clients in the game (but not the server). However, when other clients see someone perform an animation with an effect, the effect is “desynced,” and looks like it triggers before the animation reaches it’s particular marker. Here’s an example of a taunt animation for my game:
This is what my client sees when I taunt. The sparkle and trail effect are normal!
However, when another client views someone taunting, you can see that the sparkle sometimes pops in too early and the trail stops early.
And to just to clarify, here’s what the server sees. It doesn’t see any of these effects because they don’t replicate to the server.
Now, I’ve tried not replicating these effects to the clients and just doing them on the server, but the same problem still arises, so that idea was scratched. I believe what is happening is that because the server animations are typically never in sync with what the client sees (the replicated server animations lag behind the client animation), when the client hits it’s specific marker to trigger effects, the effects display still without considering the server animations.
To show what I’m doing in the code, here’s the section that deals with the taunt effect:
tauntTrack:GetMarkerReachedSignal("Trail"):Connect(function(enabled)
if enabled == "true" then
replicatedWorkerModule.enableEffectObjects({object = swordTrail, state = true})
replicatedWorkerModule.playSound(rootPart, "199145204", 0.5, 0.9)
else
replicatedWorkerModule.enableEffectObjects({object = swordTrail, state = false},
{object = sparkle, emit = 1},
{object = wave, emit = 1},
{object = flare, emit = 1})
replicatedWorkerModule.playSound(rootPart, "4108911043", 0.8, 1, 0.5)
end
end)
My overall goal is to remove the “delay” between the replicated server animation and the effect and make the replicated server animation be in sync with the effect. Would it be a wise idea to add GetMarkerReachedSignal events server-sided as well and then use the RemoteEvent from there? And if that’s the case, would it be better to just have the majority of the animations run server-sided? Or would it be better to have each client render every other client’s animations, and simply don’t trust the server replicated animations? I’m kind of stuck at a crossroads right now, and I don’t want to continue ahead until I have a definitive answer on what I should do (I don’t want to refactor the code again lol). Any suggestion is helpful! Thanks for reading.