Hello, I am using the code below to play animations on my view model that are playing on the player’s character.
My current issue is that some animations will not play, whereas some do. On the server, the animations are visible on the player’s character, so they are playing. The animations that do play are my idle, walking and running, but the idle crouch animation does not play and the moving crouch animation plays but does not stop.
local LoadedAnimations = {}
Animator.AnimationPlayed:Connect(function(AnimationTrack)
if not LoadedAnimations[AnimationTrack] then
LoadedAnimations[AnimationTrack] = ViewModelAnimator:LoadAnimation(AnimationTrack.Animation)
end
end)
local function updateAnimations()
for CharAnim, Anim in pairs(LoadedAnimations) do
if CharAnim.IsPlaying ~= Anim.IsPlaying then
if CharAnim.IsPlaying then
Anim:Play()
else
Anim:Stop()
end
end
Anim.TimePosition = CharAnim.TimePosition
Anim:AdjustWeight(CharAnim.WeightCurrent, 0)
end
end
In the code above, the if statement where animations are played/stopped does occur, as a print statement does print when the animation is supposed to play/stop.