local tool = script.Parent local anim = Instance.new("Animation") anim.AnimationId = "http://www.roblox.com/Asset?ID=3481508555" local track tool.Equipped:Connect(function() track = script.Parent.Parent.Humanoid:LoadAnimation(anim) track.Priority = Enum.AnimationPriority.Action track.Looped = true --Loop doesn't work? track:Play() end) tool.Unequipped:Connect(function() if track then track:Stop() end end)
I
Animations seem to be a bit finicky at times when I've tried to deal with them but I've had some decent success with them. In the case of say, an idle animation, I'd recommend just changing the already available idle animations found within the player's character model through:
player.Character.Animate.idle.Animation1.AnimationId = --(Your animation ID) player.Character.Animate.idle.Animation2.AnimationId = --(Your animation ID) local idle =player.Character.Animate.idle.Animation1.AnimationId = --(Your animation ID) player.Character.Humanoid:LoadAnimation(idle):Play()
All you have to do is store the old ID's into a variable for later use during the unequipped function. This is the way I've managed it at least. Not sure if this is the best method but it's what I use and it's been very successful for what I've been trying to achieve.
Also, for animations that you intend to have playing continuously, in the Animation Editor there should be a button that looks like a play button with an arrow wrapped around that's up next to time. You'll want to make sure that is on.
i think this may be an easy answer, before your tool.Equipped function add this
anim.Looped = true
i think this may loop the animation