So I’m making a story game with my friend @MrTumbleWede and things have been going well until we had trouble playing an animation to the NPCs. Even he made a similar topic on this issue but we got no help so I’m remaking this on my profile hoping for some help… I made sure that the animation priority was the highest (Action) and it still won’t play I also made it so when the animation is playing, I disable the character animation script so it doesn’t interfere with it. Here is the code responsible for it:
function PlayAnimation(character, id, stopLoop)
if character:FindFirstChild("Humanoid") then
local animation = Instance.new("Animation", script)
animation.AnimationId = "rbxassetid://" .. id
local animationTrack = character:FindFirstChildOfClass("Humanoid"):LoadAnimation(animation)
animationTrack.Priority = Enum.AnimationPriority.Action
animationTrack:Play()
if stopLoop then
if animationTrack.Looped then
animationTrack.DidLoop:Connect(function()
animationTrack:Stop()
end)
end
end
return animationTrack
end
end
function ToggleAnimation(character, bool)
character.Animate.Disabled = not bool
end
ToggleAnimation(game.Workspace.James, false)
PlayAnimation(game.Workspace.James, 5514997964, false)
ToggleAnimation(game.Workspace.Jack, false)
PlayAnimation(game.Workspace.Jack, 5514997964, false)
“James” and “Jack” are both NPCs located in Workspace
and I could get other animations to load for it like the point emote and a custom sword slash animation I made. Characters are not welded or anchored at all and even the animation is also uploaded from the same group… I honestly don’t understand why it won’t work. Let me know if you can help, thanks!