I'm making a game, and whenever the player gets close to an NPC I'm making, the NPC will stop its animation and start a new one that makes it look at the player. However, the NPC pauses for a second when switching animations. My main problem, though, is that the animation loops. How can I fix this?
(By the way, it's not finished yet. All I have is the NPC playing an animation and after 5 seconds it plays the different animation.)
local animation = Instance.new("Animation")
animation.Parent = workspace.Dummy
animation.AnimationId = "rbxassetid://4718550145"
local humanoid = workspace.Dummy.Humanoid
local track = humanoid:LoadAnimation(animation)
track:Play()
wait(5)
track:Stop()
local look = Instance.new("Animation")
look.Parent = workspace.Dummy
look.AnimationId = "rbxassetid://4719138648"
local track2 = humanoid:LoadAnimation(look)
track2.Looped = false
track2:Play()
Edit: What I did wrong was set the animation priority to "Core" and not "Action". But I've encountered a new problem! I want the NPC to stay still at the last frame, but after the animation finished, the NPC just stands there.

1 comment
Which animation is looping? The second one shouldn't since that you coded it not to.