Description:
If GetPlayingAnimationTracks is locally called on a Humanoid object, this causes replication of any animations loaded afterwards to only show on the local client, and not replicate to the server and by extension nor to other clients.
I had to waste about 12 hours of development time tracking down this issue, because this is a completely silent issue and even breaks replication when nothing is done to the animation tracks. Even just calling the GetPlayingAnimationTracks method will cause replication to break.
Minimal repro:
GetPlayingAnimationTracks_broken_repro.rbxl (13.8 KB)
This is a minimal repro (baseplate with a couple of really small scripts) that I obtained by stripping down by game until I found the line causing the issue.
There are four relevant objects:
- DoBug: just a boolean value to easily turn on/off the occurrence of the bug while playing (it will not do a GetPlayingAnimationTracks call on CharacterAdded when this is set to false)
- Animator (server): a small script that adds a CollectionService tag to all Humanoids that enter workspace.
- Animate (client): starter character script that just plays a looping animation on the client’s character. This is intentionally as simple as possible. The animation track is reused, not reloaded every time.
- Animator (client): a small script that, when DoBug.Value == true, will call GetPlayingAnimationTracks on every Humanoid in the game that obtains the CollectionService tag given by Animator (server).
Relevant code of Animator (client) that causes the bug:
(...)
local function processAnimator(animator)
if DoBug.Value then
print("Doing the bug by calling GetAnimationTracks")
animator:GetPlayingAnimationTracks() -- not even doing anything with tracks...
end
end
(...)
Repro steps:
- Open the file above
- Press Play (Accurate Play Solo)
- Observe that the character has an animation on the client
- Change the view to Server (next to Play button while playing)
- Observe that the character is not correctly animated on the server (and by extension, not animated on other clients)
- Turn ReplicatedStorage.DoBug.Value to false
- Go back to Client view (next to Play button while playing)
- Reset your character (Esc > R)
- Observe that the character has an animation on client
- Change the view to Server (next to Play button while playing)
- Observe that, now that GetPlayingAnimationTracks was not called, the animation correctly replicates to the server (and by extension, animated on other clients too)
Unexpected behavior:
Calling GetPlayingAnimationTracks locally can sometimes break replication of animations to the server for that Humanoid/AnimationController object.
Expected behavior:
Whether or not I call GetPlayingAnimationTracks or do anything with the tracks locally, this should never break replication to the server of that Humanoid/AnimationController object.
Additional information:
Studio version: 0. 360. 3. 253053
Happens both in live games as well as Studio instances (Play Solo / Test Server + Players)