If an AnimationTrack is created on the server, and properties such as
AnimationTrack.Priority are set (on the server), then when the AnimationTrack replicates to the client, those properties appear to replicate when read from the instance and printed; however, the behavior does not replicate.
For example, if the following code is ran on the server:
local Animation = Instance.new("Animation") Animation.AnimationId = "http://www.roblox.com/asset/?id=3695300085" local RunService = game:GetService("RunService") game.Players.PlayerAdded:Connect(function(Player) Player.CharacterAdded:Connect(function(Character) while Character.Parent ~= workspace do RunService.Stepped:Wait() end local Track = Character.Humanoid:LoadAnimation(Animation) while Track.Length == 0 do --wait for animation to load RunService.Stepped:Wait() end Track.Looped = true Track.Priority = Enum.AnimationPriority.Action print("[Server] Priority: "..tostring(Track.Priority)) print("[Server] Looped: "..tostring(Track.Looped)) Track:Play() end) end)
And this code is inserted into a LocalScript under
script.Parent.Humanoid.AnimationPlayed:Connect(function(Track) if Track.Name == "Animation" then --to ignore default character animations print("[Client] Priority: "..tostring(Track.Priority)) print("[Client] Looped: "..tostring(Track.Looped)) end end)
The following output is produced:
[Server] Priority: Enum.AnimationPriority.Action [Server] Looped: true [Client] Priority: Enum.AnimationPriority.Action [Client] Looped: true
Indicating that the
AnimationTrack.Looped properties should have replicated. In reality, they are not replicated, and the AnimationTrack is overwritten by the default walking animations, and it does not loop.
Note that this bug has nothing to do with the animation not being loaded yet, as I wait for the AnimationTrack to load in the above code.
To get the behavior of the properties to replicate, the following code is necessary in that same LocalScript:
script.Parent.Humanoid.AnimationPlayed:Connect(function(Track) Track.Priority = Track.Priority Track.Looped = Track.Looped end)
Now, the behavior replicates as expected.
I’ve included a repro place with the above code. Uncomment the lines in the LocalScript to fix the bug
animation bug repro.rbxl (19.1 KB) .