How do I add an animation to a tool?

Hello! I have been trying to make a tool with animations like walking animations and idles and stuff like that. I made a script but it didn’t work. friends helped out but no success.

Here’s the script;

local character = Player.Character or Player.CharacterAdded:Wait(); -- character needs time to load so you have to wait for it
local animate = character:WaitForChild('Animate') -- WaitForChild waits FindFirstChild doesn't wait

script.Parent.Equipped:Connect(function()
    character.animate.walk.WalkAnim.AnimationId = "rbxassetid://5351059805" 
    character.animate.idle.Animation1.AnimationId = "rbxassetid://5351027528" 
    character.animate.idle.Animation2.AnimationId = "rbxassetid://5351027528" 
end)

Thanks for reading!

oh and this is the error i get;
07:49:24.377 - animate is not a valid member of Model

The error clearly explains that there is no Instance named “animate” that is parented to the character.

1 Like

Yeah I know that. But I made it a variable. The actual item present in the character is called “Animate” and if you look at the variables in the script, it is clearly stated.

You assigned character:WaitforChild(“Animate”) to the variable animate, but then you tried to reference it by using Character.animate, which looks inside the character model for “animate” which doesn’t exist.

You can fix it by changing Character.animate.walk… to Character.Animate.walk… and similarly changing the rest or by changing character.animate to animate.walk, animate.idle etc, etc…

That makes sense. thanks! So instead of character.animate, i can do animate.walk.blah right?

1 Like