What is the best way to create an idle and walking animation script for tool

I want to change idle and walk animation when player equip tool.

I tried change player’s animation id when player equip tool but if player walking when equip tool animations will not replaced until player stop walking.

What is the best way to create an idle and walking animation script for tool.
thx

Ps. My English is kinda broken since it’s not my native language :frowning:

5 Likes

i have same problem… don’t wanna repost… so…
bump!

1 Like

You have to override the default “Animate” script by creating a blank local script in StarterPlayer > StarterCharacterScripts to disable the default animate script

1 Like

thats not what he’s asking for. did you even read the topic?
he’s asking:
I want to keep everything the same,
BUT, if I am equipping a tool, the idle animation and walking animation should change.

I did… Whatever you do as long as that animate script is there it will just override any animations you try to play unless its Action priority

1 Like

no you didn’t
you’re just telling him how to replace animations, not replace animations only when a certain tool is equipped

Thats because it aint possible

Make an animation, change it’s priority to Idle, and make sure it’s looped. If you want the arm where the player holds the tool, then you will have to weld the tool.

None of you guys are answering his question, his question is how does he change the player’s default animate script’s idle and walk animations when a tool is equipped or unequipped. Now his problem is that the animations don’t change until you move or stop moving while the animations are changed. For this kind of problem you have to find a way to refresh the animation tracks after they are changed which shouldn’t be too hard. Try something like animation:Refresh() or something. The example I just used doesn’t actually work and is only for reference.

1 Like

I would do this.

local ActivatedConnection;
Tool.Equipped:Connect(function(Mouse)
    --Walk/Idle Animation
    ActivatedConnection = Tool.Activated:Connect(function()
        -- Tool Use animation
    end)
end)
Tool.Unequipped:Connect(function()
    ActivatedConnection:Disconnect()
end)

To change the animation you will have to access the players Animation Tracks and stop them. Then replace the animation Ids then let the animation script do the rest!

for _, playingTracks in pairs(humanoid:GetPlayingAnimationTracks()) do
	playingTracks:Stop(0)
end

local animateScript = character:WaitForChild("Animate")
animateScript.run.RunAnim.AnimationId = "rbxassetid://616163682"        -- Run
animateScript.walk.WalkAnim.AnimationId = "rbxassetid://616168032"      -- Walk
animateScript.jump.JumpAnim.AnimationId = "rbxassetid://616161997"      -- Jump
animateScript.idle.Animation1.AnimationId = "rbxassetid://616158929"    -- Idle (Variation 1)
animateScript.idle.Animation2.AnimationId = "rbxassetid://616160636"    -- Idle (Variation 2)
animateScript.fall.FallAnim.AnimationId = "rbxassetid://616157476"      -- Fall
animateScript.swim.Swim.AnimationId = "rbxassetid://616165109"          -- Swim (Active)
animateScript.swimidle.SwimIdle.AnimationId = "rbxassetid://616166655"  -- Swim (Idle)
animateScript.climb.ClimbAnim.AnimationId = "rbxassetid://616156119"

Of course I would replace the aniamtion Ids

3 Likes

uh hi it’s me from the future, my solution to this problem is to change animation id in the local script called “Animate” which located in the character and then do Humanoid:ChangeState(Enum.HumanoidStateType.Landed) in any local script and it should reset the animation to the new one u just changed the id to.

maybe it’s too late lol but i found the solution

1 Like

It’s likely too late as well but its been a long time and I’ve already come up with a good solution, make a constant loop that alternates between playing walk or idle depending on player’s move velocity.
Example:
if math.floor(character.HumanoidRootPart.Velocity.Magnitude) > 0 then
–play walk animation and stop idle animation
end
if math.floor(character.HumanoidRootPart.Velocity.Magnitude) <= 0 then
–play idle animation and stop walk animation
end

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.