NPC animation troubles

Script:

–Made by TotalClip–

–Insert this into your character–
local hum = script.Parent:WaitForChild(“Humanoid”)
local anim = hum:LoadAnimation(script:FindFirstChildOfClass(“Animation”))
anim.Looped = true
anim:Play()

(not mine script)

I have trouble: I need to make animation loop on npc, Its works only in RUN- but its don’t work in PLAY
image

2 Likes

Is the script a LocalScript or a server script?

image
idk, this script:

That’s a server Script and WaitForChild is meant to be used in LocalScripts so try changing the code to:

local animationTrack = script.Parent.Humanoid.Animator:LoadAnimation(script.Animation)
animationTrack.Looped = true
animationTrack:Play()
1 Like

Its not helps( Its still works only in RUN, but not in PLAY** In RUN all works correct but in PLAY its works only 1 time without animation loop

I’ll need to see your character and all objects inside to see if there’s something interfering. Also, if you have any errors in the output please tell me what they are

1 Like

image

Output empty**

1 Like

Unfortunately I don’t see anything that could possibly cause this problem so try these steps:

  1. Go to the “Avatar” tab in Studio at the top next to “Model”
  2. Click on “Rig Builder” and when the menu opens click on “Block Avatar”
  3. A new character model will be placed in Workspace named “Rig”. Open the model and delete the script named “Animate”
  4. Insert a new server Script inside the rig, and add the animation you want as a child of that script
  5. Copy the code I gave you and paste it inside the new Script
  6. Test both Run and Play and see if the animation plays correctly

I tried these steps myself and the animation is playing correctly for me

1 Like

Its still corect only in RUN, in play its still playing only 1 time and not looping.

Then most likely there’s another script somewhere in your game that’s preventing the animation from playing correctly as when I test in a default baseplate the script works correctly with the rig like so:

i tryed in empty game and in my game- same results

The only possible issues left that I can think of is either a plugin you have installed is causing this problem or it could also be a bug in your version of Studio. I don’t think I’ll be able to continue helping you with this problem unfortunately so I wish you luck finding the solution

1 Like


did you make sure this was on?

1 Like

Does the animation match up with the Characters Type? Lets say you made an R15 Animation and your NPC is R6, the animation will probably only run for the head. Make sure your NPC is the same Character Type as the animation

MAN YOU SAVED ME :sob::sob: THANK YOUU SO MUCH. I don’t knowed about i need on this

1 Like

You should know that if you’re doing this: AnimationTrack.Looped = true on the server-side, then it won’t be looped on the client-side and vice-versa because it doesn’t replicate. It’s best to change your settings to whatever you need inside the animation editor

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.