Make an NPC play an animation(Loop)

Hello, I need help
Who can tell me how to make an NPC do an animation(Loop)
Example


Thank u
Sorry if some things don’t make sense I used a translator

12 Likes

pretty sure the animation needs to be set to action? also put it looped of course well uh im not the best scripter so not really sure what i can say more.

2 Likes

Yes,But i need a script no?


2 Likes

Yes you do need a script to make it work that’s for sure.

1 Like

Does some one kwo wat script xD

1 Like

Perhaps this might help you, https://www.youtube.com/watch?v=tkrbmFFBvOQ. (Unfortunately that video is outdated now, but there’s more videos about it)

3 Likes

First, you’ll need to make sure the animation has the loop setting checked in the animation editor. To make the NPC play the animation, you’ll want to put a script inside the NPC and type something like this inside the script:

local AnimationObject = Instance.new("Animation")
AnimationObject.Parent = script.Parent
AnimationObject.AnimationID = “http://www.roblox.com/asset/?id=animationidhere”

local Animation = script.Parent.Humanoid:LoadAnimation(script.Parent.Animation)

Animation:Play()

Hopefully this helps. If you have any questions feel free to ask :smiley:

1 Like

image

1 Like

Try doing this:

local AnimationId = --//Put in the id here

local Animation = Instance.new("Animation")
Animation.AnimationId = ("rbxassetid://%d"):format(AnimationId)
local AnimationTrack = script.Parent.Humanoid:LoadAnimation(Animation)
AnimationTrack.Looped = true
AnimationTrack:Play()
15 Likes

My bad, try this instead:

AnimationObject.AnimationID = “http://www.roblox.com/asset/?id=animationidhere

3 Likes

actually ty it worked


2 Likes

Thanks All for helping me!


3 Likes

No problem, just happy to help.
Not trying to be pushy, but can you give the person who fixed the problem a solution by clicking the solution button under their reply?

1 Like

I alredy do it lol


1 Like

Ok, thank you! :smiley:
I’ve been trying to collect those solutions.

1 Like

Np!
Cya


1 Like

a little late to the convo here, but where would I put this script? HumanoidRoot, the literal NPC group itself, or anywhere else? Also, Is it a normal script or local? Thank you!

1 Like