Is there any way to add move animations to tools?

  • What does the code do?
    The code makes an animation play when the tool is equipped
  • What potential improvements have you considered?
    I tried using Enum.HumanoidStateType but that didnt work
  • How (specifically) do you want to improve the code?
    I would like the code to make an animation play when you are moving and have the tool equipped
local player = game.Players.LocalPlayer

repeat wait(1) until player.Character

local character = player.Character
local humanoid = character:WaitForChild("Humanoid")

local idle = script.Idle
local move = script.Move
local idletrack = humanoid:LoadAnimation(idle)
local movetrack = humanoid:LoadAnimation(move)

script.Parent.Equipped:connect(function()
	idletrack:Play()
end)

script.Parent.Unequipped:connect(function()
	idletrack:Stop()
end)
1 Like

You can go into the character and there will be an Animate script and you just change the animation id under it where it says walk to the walk animation and when you unequip the item you can just change the animation id back to the old one.

local player = game.Players.LocalPlayer

repeat wait(1) until player.Character

local character = player.Character
local humanoid = character:WaitForChild("Humanoid")

local idle = script.Idle
local move = script.Move
local idletrack = humanoid:LoadAnimation(idle)
local movetrack = humanoid:LoadAnimation(move)
local Animate = character:FindFirstChild("Animate")
local OldWalkID = Animate.walk.WalkAnim.AnimationId
local OldIdleID = Animate.idle.Animation1.AnimationId 

script.Parent.Equipped:connect(function()
    Animate.idle.Animation1.AnimationId = idle.AnimationId
    Animate.idle.Animation2.AnimationId = idle.AnimationId
    Animate.walk.WalkAnim.AnimationId = move.AnimationId
end)

script.Parent.Unequipped:connect(function()
    Animate.idle.Animation1.AnimationId = OldIdleID
    Animate.idle.Animation2.AnimationId = OldIdleID
    Animate.walk.WalkAnim.AnimationId = OldWalkID
end)

script would look something like this ^

1 Like

Thanks! But there is a delay in which you have to stop walking to change the old walk anim to the new one. Any way to fix this?

Yeah try playing the idle animation in the same line and there won’t be that delay I don’t think

Ok I will do what you suggested and add a wait so that it waits a short time before playing the run animation

That did not work. Also this is the issue:

robloxapp-20210925-1305039.wmv (2.2 MB)