Worldmodel not playing an NPC's animations?

Hi! I have an NPC that plays animations when in the workspace.

If i place it inside a worldmodel as seen below:

The animation no longer plays and the NCP stands idle/frozen.

Any idea how to work worldmodel?

Could you show us the script? We don’t understand the error if you don’t.

The error isn’t with the script I believe, it seems so many people have this issue with using world models. But the script I use to play this animation is:

local animation = script:WaitForChild('AnimationID')

local humanoid = script.Parent:WaitForChild('Humanoid')

local dance = humanoid:LoadAnimation(animation)


dance.Looped = true

This makes the animation work in workspace, but not in that worldmodel/viewportframe.

Don’t use Humanoid to load the animation. Use Animator instead.

Ah, how do I go by doing this? I’m not really experienced with animation etc.

sample code from API:

local function playAnimationFromServer(character, animation)
  local humanoid = character:FindFirstChildOfClass("Humanoid")
  if humanoid then
-- need to use animation object for server access
  local animator = humanoid:FindFirstChildOfClass("Animator")
      if animator then
      local animationTrack = animator:LoadAnimation(animation)
      return animationTrack

if I recall correctly, for NPC’s you will need to first an Animator object, parented to humanoid, players already have Animator within their humanoids.

If an Animator is not present in the character’s Humanoid, add it by searching up Animator. Then, used the same method you used but instead use the Animator to load the animation instead.

Using this code inside of the NPC’s model still causes it to stand idle.

It is just sample code, you should not be copy and pasting.

construct your code based off utilizing sample code; animator api. you also need to read my recommendation on'ing an Animator Object

Did you check the animation priority? If you haven’t. Set it to idle.