I have two walking animations, a normal walk and a sprint. When players pull out their sword I change the animation script in their character to be the new run animation. When an animation is changed, the script notices and replaces the current playing one with the new one (I am using a custom animate script).
This code does the seamless changing:
-- Update animations if they change while playing
for i,v in pairs(animations:GetChildren()) do
v:GetPropertyChangedSignal("AnimationId"):Connect(function()
LoadedAnimations[v.Name]:Stop(0.5)
LoadedAnimations[v.Name]:Destroy()
LoadedAnimations[v.Name] = nil
local newAnim = humanoid.Animator:LoadAnimation(v)
LoadedAnimations[v.Name] = newAnim
end)
end
However, even though the animation changes fine on the client it doesn’t on the server. The old walking animation never stops! I clearly have it stop though, using this line:
LoadedAnimations[v.Name]:Stop(0.5)
Why is this? Is there a way to get around this?