Tool run script

I need help with something, I need a tool run animation script. So when I press shift while moving and holding the tool it will play the animation but if I’m not moving the animation won’t play can someone please give me the script been looking forever can’t find it
Thanks

this should help What is the best way to script a tool run animation? - Help and Feedback / Scripting Support - DevForum | Roblox

1 Like

I need the whole script bc I don’t know what to do

Weapon.Equipped:Connect(function(mouse)
    local Character = player.Character
    local Humanoid = Character:WaitForChild("Humanoid")
    local runanimation = Humanoid:LoadAnimation(script.Parent.RunAnimation)

    local inputBeganConnection, unequippedConnection

    inputBeganConnection = UserInputService.InputBegan(function(input, gameProccessed)
        if not gameProccessed then
            if input.KeyCode == Enum.KeyCode.LeftShift and (input.KeyCode == Enum.KeyCode.W or input.KeyCode == Enum.KeyCode.A or input.KeyCode == Enum.KeyCode.S or input.KeyCode == Enum.KeyCode.D) then
                runanimation:Play()
            end
        end
    end)

    unequippedConnection = Weapon.Unequipped:Connect(function()
    	inputBeganConnection:Disconnect()
    	unequippedConnection:Disconnect()
    end)
end)

We’re do I put the animation code ?

local script in tool but use this script

local Weapon = script.Parent
local player = game.Players.LocalPlayer
Weapon.Equipped:Connect(function(mouse)
    local Character = player.Character
    local Humanoid = Character:WaitForChild("Humanoid")
    local runanimation = Humanoid:LoadAnimation(script.Parent.RunAnimation)

    local inputBeganConnection, unequippedConnection

    inputBeganConnection = UserInputService.InputBegan(function(input, gameProccessed)
        if not gameProccessed then
            if input.KeyCode == Enum.KeyCode.LeftShift and (input.KeyCode == Enum.KeyCode.W or input.KeyCode == Enum.KeyCode.A or input.KeyCode == Enum.KeyCode.S or input.KeyCode == Enum.KeyCode.D) then
                runanimation:Play()
            end
        end
    end)

    unequippedConnection = Weapon.Unequipped:Connect(function()
    	inputBeganConnection:Disconnect()
    	unequippedConnection:Disconnect()
    end)
end)