Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I add a walking animation when holding tool?

Asked by 3 years ago
Hello! I've been trying to make an Idle animation and a Walking animation when holding a wooden knife. 
I've managed to make the Idle animation work, however, when I try to put a walking animation, even if the priority of the walking animation is higher, I move while having the Idle animation. Idle is set to Idle and Walking was set to Action (I also tried movement)

Here's the code with the idle animation:

local tool = script.Parent
local anim = Instance.new("Animation")
anim.AnimationId = "http://www.roblox.com/Asset?ID=7090386149"
local track
tool.Equipped:Connect(function()
    track = script.Parent.Parent.Humanoid:LoadAnimation(anim)
    track.Priority = Enum.AnimationPriority.Action
    track.Looped = true
    track:Play()
end)
tool.Unequipped:Connect(function()
    if track then
        track:Stop()
    end
end)

I'm trying to achieve a walking animation, but when I do, my character moves with the idle animation instead.

Answer this question