#Custom Animate script not working properly

1 messages · Page 1 of 1 (latest)

runic light
#

My animations are playing perfectly on the client, stopping and starting as expected but on the server some of the animations don't stop causing weird blending issues that are visible to other players but not you. It doesn't make any sense because last I read starting and stopping were replicated

#
function PlayAnimation(Animation : Animation, Weight)
    
    if not Weight then Weight = 0.25 end
    
    if Animtrack then
        if Animation.Name == CurrentAnimation then return end
        if AnimChangedFunc then AnimChangedFunc:Disconnect() end
        
        local AnimationTracks = Animator:GetPlayingAnimationTracks()
        
        for i = 1, #AnimationTracks do
            local Track : AnimationTrack = AnimationTracks[i]
            Track:AdjustWeight(0)
            Track:Stop(0)
            Track:Destroy()
        end
        
    end

    Animtrack = Animator:LoadAnimation(Animation)
    Animtrack:Play(0, 1, 1)
    Animtrack:AdjustWeight(1)

    AnimChangedFunc = Animation.Changed:Connect(function()
        
        CurrentAnimation = nil
        PlayAnimation(Animation)
        
    end)

    LastAnimWeight = Weight
    CurrentAnimation = Animation.Name

end```
#

this is my code for playing and stopping animations

#
Humanoid.Running:Connect(function(speed)

    if speed < 0.1 then PlayAnimation(StandardAnimationsFolder.Idle) return end
        
    if speed < 20 then
        PlayAnimation(Animations.Walk, 0.5)
    else
        PlayAnimation(Animations.Run, 0.5)
    end
    
end)

PlayAnimation(StandardAnimationsFolder.Idle)```
#

and this is how it's used