I have an NPC that I’d like to have loop an animation, but I don’t know how to make it do so? I tried making a script, but either it was wrong entirely, or I was putting it in the wrong part of the NPC or it was the wrong type of script, I’ll put the script I used below. I’d like to know 1, if that script works, and how I could improve it. 2, where to put it in the NPC, and 3, What type of script to use (I originally had it in a regular script)
Thank you, and Happy New years!
local AnimationId = --the ID
local Animation = Instance.new("Animation")
Animation.AnimationId = ("rbxassetid://%d"):format(AnimationId)
local AnimationTrack = script.Parent.Humanoid:LoadAnimation(Animation)
AnimationTrack.Looped = true
AnimationTrack:Play()
local id = Id
local Animation = Instance.new("Animation")
Animation.Parent = parent
Animation.AnimationId = "rbxassetid://"..I'd
local Track = script.Parent.Humanoid.Animator:Load animation(Animation)
Track.Looped = true
Track:play()
local id = "123456789" -- copy your animation's number ID
local Animation = Instance.new("Animation")
Animation.Parent = parent
Animation.AnimationId = "rbxassetid://"..Id
local Track = script.Parent.Humanoid.Animator:LoadAnimation(Animation)
Track.Looped = true
Track:Play()
Put This script under the Rig, also you need to set the animation property to movement or action, (movement if you want walking loop animation, action if you want to loop anything else)