Animations are loaded only once.
This is the PlayAnimation script
local function PlayAnimation (AnimationName,Looped)
local AnimationObject:AnimationTrack = Animations[AnimationName]
if not LastAnimation then
LastAnimation = AnimationObject
AnimationObject.Looped = Looped
AnimationObject.Priority = Enum.AnimationPriority.Action
AnimationObject:Play()
return
end
print(LastAnimation,AnimationObject)
print(AnimationObject == LastAnimation and LastAnimation.IsPlaying)
if (AnimationObject == LastAnimation and LastAnimation.IsPlaying) or not AnimationObject then
return
end
LastAnimation:Stop()
LastAnimation.TimePosition = 0
AnimationObject.Looped = Looped
AnimationObject.Priority = Enum.AnimationPriority.Action
AnimationObject:Play()
LastAnimation = AnimationObject
end
LastAnimation is a nil from start
The function should stop the previous animation and play the new one.
Instead it plays animation only once.